Python - Ayuda con Programación de Inventario de Panadería hecho en Pyton

 
Vista:

Ayuda con Programación de Inventario de Panadería hecho en Pyton

Publicado por Carlos Eduardo (1 intervención) el 29/05/2019 17:49:07
Hola reciban un cordial saludo me gustaría pedirles ayuda para que me den una manito con este proyecto de Inventario de una Panadería en PYTON , tengo un pequeño lió me gustaría centrar todos los textos y que al momento de ingresar el producto le pudiera ingresar su respectiva imagen o si es posible un código de barras , pero he intentado de todo y no he podido.

CÓDIGO DE EJEMPLO:

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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
import tkinter as tk
import sqlite3
from tkinter import messagebox
 
######## VENTANA PARA INSETAR DATOS    
 
def ventana_agregar():
    #windows.withdraw()
    window=tk.Toplevel()
    window.geometry("512x512")
    e1=tk.Label(window, text="AGREGAR PRODUCTOS :",bg="sky blue",fg="black").place(x=50, y=50),
 
 
 
# variable producto
    entryproducto=tk.StringVar()
    productotx=tk.Entry(window,textvariable=entryproducto).place(x=50, y=150)
 
 
 
# variable  precio
    entryprecio=tk.StringVar()
    preciotx=tk.Entry(window,textvariable=  entryprecio).place(x=50, y=230)
 
 
 
# Etiqueta para "INGRESE NOMBRE DEL PRODUCTO"
    etiquetanombre=tk.Label(window, text="INGRESE NOMBRE DEL PRODUCTO.", padx=10 ).place(x=30, y=115)
 
 
 
 
#Etiqueta para "INGRESE PRECIO DEL PRODUCTO"
    etiquetaprecio = tk.Label(window, text="INGRESE PRECIO DEL PRODUCTO", padx=10 ).place(x=30, y=200)
 
## Boton menu  
 
    menu=tk.Button(window, text="MENU", fg="red",font=("arial", 12),cursor = "hand2",relief = "raised",command = window.destroy)
    menu.pack()
    menu.place(x=50,y=350)
 
    def guarda():
 
            db = sqlite3.connect("articulos.s3db")
            c = db.cursor()
 
            nombre = entryproducto.get()
            precio = entryprecio.get()
 
 
            c.execute("insert into articulos (nombre,precio) values ('"+nombre+"','"+precio+"')")
            db.commit()
            c.close()
            messagebox.showinfo("MODIFICACION","ARTICULO INGRESADO" )
            window.destroy()
            ventana_agregar()
 
    btguardar = tk.Button(window, text =  "GUARDAR", fg="blue",font=("arial", 12),cursor = "hand2",relief = "raised",command = guarda)
    btguardar.pack()
    btguardar.place(x=300,y=350)
 
 
 
 
######## VENTANA PARA VER LOS DATOS
def ventana_ver():
    #.withdraw()
    window=tk.Toplevel()
    window.geometry("512x512")
    e1=tk.Label(window, text="BUSCAR PRODUCTOS :",bg="white",fg="black").place(x=50, y=50),
    e_codigo=tk.Label(window, text="CODIGO",bg="white",fg="black").place(x=50, y=70)
    e_nombre=tk.Label(window, text="NOMBRE",bg="white",fg="black").place(x=150, y=70)
    e_precio=tk.Label(window, text="PRECIO",bg="white",fg="black").place(x=250, y=70)
    def mostrar():
##        codigo
        lista=tk.Listbox(window, width = 30, font=("arial", 12), height =15 )
        lista.pack()
        db = sqlite3.connect("articulos.s3db")
        c = db.cursor()
        c.execute("select * from articulos ORDER BY (codigo)DESC")
        for row in c:
            lista.insert(0,row[1]+"---------------"+ row[2])
        lista.place(x=150,y=90)
##        nombre
        lista_1=tk.Listbox(window, width = 10, font=("arial", 12), height =15 )
        lista_1.pack()
        db = sqlite3.connect("articulos.s3db")
        c = db.cursor()
        c.execute("select codigo from articulos ORDER BY (codigo)DESC")
        for row in c:
            lista_1.insert(0,row[0])
        lista_1.place(x=50,y=90)
 
 
 
    menu=tk.Button(window, text="MENU", fg="red",font=("arial", 12),cursor = "hand2",relief = "raised",command = window.destroy)
    menu.pack()
    menu.place(x=50,y=400)
 
    bt_mostrar = tk.Button(window, text =  "MOSTRAR PRODUCTOS", fg="blue",font=("arial", 12),cursor = "hand2",relief = "raised",command = mostrar)
    bt_mostrar.pack()
    bt_mostrar.place(x=280,y=400)
 
 
 
 
 
########## VENTANA PARA ELIMINAR DATOS
 
def ventana_eliminar():
    window=tk.Toplevel()
    window.geometry("512x512")
    e1=tk.Label(window, text=" ELIMINAR PRODUCTOS :",bg="white",fg="black").place(x=50, y=50)
 
#### VARIABLE PARA ID
 
    entry_id=tk.StringVar()
    productotx=tk.Entry(window,textvariable=entry_id).place(x=50, y=150)
 
#### ETIQUETA PARA ID
 
    etiquetanombre=tk.Label(window, text="INGRESE CODIGO DEL PRODUCTO", padx=10 ).place(x=30, y=115)
 
    def eliminar():
        db = sqlite3.connect("articulos.s3db")
        c = db.cursor()
 
        id_producto = entry_id.get()
 
        c.execute("DELETE  from articulos where codigo = ('"+id_producto+"')")
        db.commit()
        c.close()
        messagebox.showinfo("MODIFICACION","ARTICULO ELIMINADO" )
        window.destroy()
        ventana_eliminar()
 
#### BOTON PARA MENU
 
    menu=tk.Button(window, text="MENU", fg="red",font=("arial", 12),cursor = "hand2",relief = "raised",command = window.destroy)
    menu.pack()
    menu.place(x=50,y=350)
#### BOTON PARA ELIMINAR
    bt_eliminar = tk.Button(window, text =  "ELIMINAR PRODUCTOS", fg="blue",font=("arial", 12),cursor = "hand2",relief = "raised",command = eliminar)
    bt_eliminar.pack()
    bt_eliminar.place(x=280,y=350)
 
###### VENTANA PARA MODIFICAR
 
 
 
def modificar_producto():
    window=tk.Toplevel()
    window.geometry("512x512")
    e1=tk.Label(window, text=" MODIFICAR PRODUCTOS :",bg="white",fg="black").place(x=50, y=50)
 
#### VARIABLE PARA ID
 
    entry_id=tk.StringVar()
    productotx=tk.Entry(window,textvariable=entry_id).place(x=50, y=150)
 
#### ETIQUETA PARA ID
 
    etiquetanombre=tk.Label(window, text="INGRESE CODIGO DEL PRODUCTO", padx=10 ).place(x=30, y=100)
 
 
#### VARIABLE PARA VALOR NUEVO
 
    entry_valor=tk.StringVar()
    valortx=tk.Entry(window,textvariable=entry_valor).place(x=50, y=250)
 
#### ETIQUETA PARA NUEVO VALOR
 
    etiquetanombre=tk.Label(window, text="INGRESE EL NUEVO PRECIO PARA EL PRODUCTO", padx=10 ).place(x=30, y=200)
 
 
 
 
    def modificar():
        db = sqlite3.connect("articulos.s3db")
        c = db.cursor()
 
        id_producto = entry_id.get()
        nuevo_precio = entry_valor.get()
 
        c.execute("update articulos set precio =('"+nuevo_precio+"') where codigo = ('"+id_producto+"')")
        db.commit()
        c.close()
        messagebox.showinfo("MODIFICACION","ARTICULO MODIFICADO" )
        window.destroy()
        modificar_producto()
 
#### BOTON PARA MENU
 
    menu=tk.Button(window, text="MENU", fg="red",font=("arial", 12),cursor = "hand2",relief = "raised",command = window.destroy)
    menu.pack()
    menu.place(x=50,y=350)
#### BOTON PARA MODIFICAR
    bt_modificar = tk.Button(window, text =  "MODIFICAR PRODUCTO", fg="blue",font=("arial", 12),cursor = "hand2",relief = "raised",command = modificar)
    bt_modificar.pack()
    bt_modificar.place(x=280,y=350)
 
 
 
 
 
windows=tk.Tk()
windows.title("Panadería y pastelería “LAS DELICIAS DOÑA ANA”");
windows.geometry("800x534")
 
image=tk.PhotoImage(file="DOÑA ANA.gif")
image=image.subsample(1,1)
label=tk.Label(image=image)
label.place(relwidth=1, relheight=1)
 
 
b1=tk.Button(windows,text="Agregar Producto", fg="blue", font=("arial", 14), borderwidth=10,cursor = "hand2",relief = "raised", command = ventana_agregar,)
b1.pack()
b1.place(x=10,y=50)
 
b2=tk.Button(windows,text="Buscar Producto", fg="blue", font=("arial", 14), borderwidth=10,cursor = "hand2",relief = "raised", command = ventana_ver)
b2.pack()
b2.place(x=10,y=150)
 
b3=tk.Button(windows,text="Eliminar Producto", fg="blue", font=("arial", 14), borderwidth=10,cursor = "hand2",relief = "raised", command = ventana_eliminar)
b3.pack()
b3.place(x=10,y=250)
 
b4=tk.Button(windows,text="Modificar Producto", fg="blue", font=("arial", 14), borderwidth=10,cursor = "hand2",relief = "raised", command = modificar_producto)
b4.pack()
b4.place(x=10,y=350)




DONA-ANA
PANTALLAZO-AL-EJECUTAR-CODIGO
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder