Código de Python - Gestor de Productos

Requerimientos

Desarrollada en Mac Os, no ha sido probada en Windows

1.0

Publicado el 23 de Diciembre del 2020gráfica de visualizaciones de la versión: 1.0
3.332 visualizaciones desde el 23 de Diciembre del 2020
estrellaestrellaestrellaestrellaestrella
estrellaestrellaestrellaestrella
estrellaestrellaestrella
estrellaestrella
estrella

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
from tkinter import *
from tkinter import messagebox as MessageBox
from tkinter import ttk
 
app = Tk()
app.geometry("510x500")
 
 
#pantallas
def home():
    app.geometry("620x500")
    home_label.config(
        fg = "#17202A",
        bg = "#A3E4D7",
        font = ("luminari", 30),
        padx = 20, pady = 20,
        width = 32
    )
    home_label.grid(row = 0, column = 0, padx = 3, pady = 3)
    productsBox.grid(row = 1)
 
    product_table.grid(row = 1, column = 0, columnspan = 3,padx = 5, pady = 5)
    product_table.heading("#0", text = "Producto", anchor = W)
    product_table.heading("#1", text="Precio", anchor=W)
    product_table.heading("#2", text="Descripcion", anchor=W)
 
 
    #listar productos
    for x in products:
        if len(x) == 3:
            x.append("Add")
            product_table.insert("", 0, text = x[0], values = x[0])
 
 
    #delete
    frame.grid_remove()
    add_label.grid_remove()
    info_label.grid_remove()
    return True
 
 
def add():
    app.geometry("500x450")
    add_label.config(
        fg="#17202A",
        bg="#A3E4D7",
        font=("luminari", 30),
        padx=20, pady=20,
        width=27
    )
 
 
 
    frame.grid(row=1)
 
    add_label.grid(row = 0, column = 0, columnspan = 4)
    #delete
    productsBox.grid_remove()
    home_label.grid_remove()
    info_label.grid_remove()
 
    #add
    add_name_label.grid(row = 3, column = 0, padx = 3, pady = 3, sticky = W)
    add_name_entry.grid(row = 3, column = 1, padx = 3, pady = 3, sticky = W)
 
    add_price_label.grid(row=4, column=0, padx=3, pady=3, sticky = W)
    add_price_entry.grid(row=4, column=1, padx=3, pady=3, sticky = W)
 
    add_description_label.grid(row=5, column=0, padx=3, pady=9, sticky = NW)
    add_description_entry.grid(row=5, column = 1, padx=3, pady=10, sticky = W)
    add_description_entry.config(width = 40, height = 15, bd = 5, relief = SOLID)
 
    save_button.grid(row = 6, column = 1, padx = 3, pady = 3)
    bye.grid(row = 6, column = 0)
 
    return True
 
 
def info():
    info_label.config(
        fg="#17202A",
        bg="#A3E4D7",
        font=("luminari", 30),
        padx=20, pady=20,
        width=27
    )
    info_label.grid(row = 0, column = 0)
    Label(app, text = "Hecho por Alexander Sanchez")
 
    #delete
    productsBox.grid_remove()
    frame.grid_remove()
    home_label.grid_remove()
    add_label.grid_remove()
    return True
 
def add_products():
    # DELETES
    productsBox.grid_remove()
 
    products.append([name_data.get(),
                     price_data.get(),
                     add_description_entry.get("1.0", "end-1c")])
    name_data.set("")
    price_data.set("")
    add_description_entry.delete("1.0", END)
 
    MessageBox.showinfo("Datos guardados:)")
 
 
    home()
 
 
#Variables
products = []
name_data = StringVar()
price_data = IntVar()
#description_data = StringVar
 
 
 
#DEclaracion de pantallas
home_label = Label(app, text = "Inicio")
productsBox = Frame(app, width = 250)
 
#TREEVIEW
product_table = ttk.Treeview(productsBox,height=21, columns=('#0', '#1'))
 
add_label = Label(app, text="Añadir producto")
 
info_label = Label(app, text="informacion")
 
#frame
frame = Frame(app)
 
#campos formularios:
add_name_label = Label(frame, text = "Nombre: ")
add_name_entry = Entry(frame, textvariable = name_data)
 
 
add_price_label = Label(frame, text = "Precio: ")
add_price_entry = Entry(frame, textvariable = price_data)
 
add_description_label = Label(frame, text = "Descripción: ")
add_description_entry = Text(frame)
 
save_button = Button(frame, text = "Guardar", command = add_products)
 
bye = Button(frame, text = "Salir", command = quit)
 
 
 
 
 
#menu
Mi_Menu = Menu(app)
app.config(menu = Mi_Menu)
 
submenu = Menu(Mi_Menu, tearoff = 0)
Mi_Menu.add_cascade(label = "Archivo", menu = submenu)
 
 
submenu.add_cascade(label= "Inicio", command = home)
submenu.add_command(label= "Añadir", command = add)
submenu.add_command(label="información", command = info)
submenu.add_separator()
submenu.add_command(label="Salir", command = quit)
 
 
 
 
if __name__ == '__main__':
    home()
    app.mainloop()



Comentarios sobre la versión: 1.0 (0)


No hay comentarios
 

Comentar la versión: 1.0

Nombre
Correo (no se visualiza en la web)
Valoración
Comentarios...
CerrarCerrar
CerrarCerrar
Cerrar

Tienes que ser un usuario registrado para poder insertar imágenes, archivos y/o videos.

Puedes registrarte o validarte desde aquí.

Codigo
Negrita
Subrayado
Tachado
Cursiva
Insertar enlace
Imagen externa
Emoticon
Tabular
Centrar
Titulo
Linea
Disminuir
Aumentar
Vista preliminar
sonreir
dientes
lengua
guiño
enfadado
confundido
llorar
avergonzado
sorprendido
triste
sol
estrella
jarra
camara
taza de cafe
email
beso
bombilla
amor
mal
bien
Es necesario revisar y aceptar las políticas de privacidad

http://lwp-l.com/s6793