@@ -13,7 +13,6 @@ def __init__(self, master, *args):
1313
1414 self .menu = True
1515 self .color = True
16-
1716 self .codigo = StringVar ()
1817 self .nombre = StringVar ()
1918 self .modelo = StringVar ()
@@ -22,7 +21,6 @@ def __init__(self, master, *args):
2221 self .buscar = StringVar ()
2322 self .buscar_actualiza = StringVar ()
2423 self .id = StringVar ()
25-
2624 self .base_datos = Registro_datos ()
2725
2826 self .frame_inicio = Frame (self .master , bg = 'black' , width = 50 , height = 45 )
@@ -39,14 +37,11 @@ def __init__(self, master, *args):
3937 self .master .rowconfigure (1 , weight = 1 )
4038 self .frame_principal .columnconfigure (0 , weight = 1 )
4139 self .frame_principal .rowconfigure (0 , weight = 1 )
42-
43-
44- self .widgets ()
45-
40+ self .widgets ()
4641
4742 def pantalla_inicial (self ):
4843 self .paginas .select ([self .frame_uno ])
49-
44+
5045 def pantalla_datos (self ):
5146 self .paginas .select ([self .frame_dos ])
5247 self .frame_dos .columnconfigure (0 , weight = 1 )
@@ -121,7 +116,6 @@ def cambiar_color(self):
121116 self .texto .config (bg = 'white' )
122117 self .bt_color .config (bg = 'white' ,activebackground = 'white' )
123118 self .color = True
124-
125119 def widgets (self ):
126120 self .imagen_inicio = PhotoImage (file = 'inicio.png' )
127121 self .imagen_menu = PhotoImage (file = 'menu.png' )
@@ -136,12 +130,10 @@ def widgets(self):
136130 self .imagen_dos = PhotoImage (file = 'imagen_dos.png' )
137131 self .dia = PhotoImage (file = 'dia.png' )
138132 self .noche = PhotoImage (file = 'noche.png' )
139-
140133 self .bt_inicio = Button (self .frame_inicio , image = self .imagen_inicio , bg = 'black' ,activebackground = 'black' , bd = 0 , command = self .menu_lateral )
141134 self .bt_inicio .grid (column = 0 , row = 0 , padx = 5 , pady = 10 )
142135 self .bt_cerrar = Button (self .frame_inicio , image = self .imagen_menu , bg = 'black' ,activebackground = 'black' , bd = 0 , command = self .menu_lateral )
143136 self .bt_cerrar .grid (column = 0 , row = 0 , padx = 5 , pady = 10 )
144-
145137 #BOTONES Y ETIQUETAS DEL MENU LATERAL
146138 Button (self .frame_menu , image = self .imagen_datos , bg = 'black' , activebackground = 'black' , bd = 0 , command = self .pantalla_datos ).grid (column = 0 , row = 1 , pady = 20 ,padx = 10 )
147139 Button (self .frame_menu , image = self .imagen_registrar , bg = 'black' ,activebackground = 'black' , bd = 0 , command = self .pantalla_escribir ).grid (column = 0 , row = 2 , pady = 20 ,padx = 10 )
@@ -155,8 +147,7 @@ def widgets(self):
155147 Label (self .frame_menu , text = 'Eliminar' , bg = 'black' , fg = 'DarkOrchid1' , font = ('Lucida Sans' , 12 , 'bold' )).grid (column = 1 , row = 4 , pady = 20 , padx = 2 )
156148 Label (self .frame_menu , text = 'Ajustes' , bg = 'black' , fg = 'DarkOrchid1' , font = ('Lucida Sans' , 12 , 'bold' )).grid (column = 1 , row = 5 , pady = 20 , padx = 2 )
157149
158-
159- ############################# CREAR PAGINAS ##############################
150+ ############################# CREAR PAGINAS ##############################
160151 estilo_paginas = ttk .Style ()
161152 estilo_paginas .configure ("TNotebook" , background = 'black' , foreground = 'black' , padding = 0 , borderwidth = 0 )
162153 estilo_paginas .theme_use ('default' )
@@ -180,34 +171,25 @@ def widgets(self):
180171 self .paginas .add (self .frame_cuatro )
181172 self .paginas .add (self .frame_cinco )
182173 self .paginas .add (self .frame_seis )
183-
184-
185174 ############################## PAGINAS #############################################
186175
187176 ######################## FRAME TITULO #################
188177 self .titulo = Label (self .frame_top ,text = 'APLICACION DE ESCRITORIO EN PYTHON CON TKINTER' , bg = 'black' , fg = 'DarkOrchid1' , font = ('Imprint MT Shadow' , 15 , 'bold' ))
189178 self .titulo .pack (expand = 1 )
190-
191179 ######################## VENTANA PRINCIPAL #################
192-
193180 Label (self .frame_uno , text = 'Electrónica Programación y Tecnología' , bg = 'DarkOrchid1' , fg = 'white' , font = ('Freehand521 BT' , 20 , 'bold' )).pack (expand = 1 )
194181 Label (self .frame_uno ,image = self .logo , bg = 'DarkOrchid1' ).pack (expand = 1 )
195182
196-
197183 ######################## MOSTRAR TODOS LOS PRODUCTOS DE LA BASE DE DATOS MYSQL #################
198184 Label (self .frame_dos , text = 'Datos de MySQL' , bg = 'white' , fg = 'DarkOrchid1' , font = ('Comic Sans MS' , 12 , 'bold' )).grid (column = 0 , row = 0 )
199185 Button (self .frame_dos , text = 'ACTUALIZAR' ,fg = 'black' ,font = ('Arial' , 11 ,'bold' ), command = self .datos_totales , bg = 'green2' , bd = 2 , borderwidth = 2 ).grid (column = 1 , row = 0 , pady = 5 )
200-
201-
202186 #ESTILO DE LAS TABLAS DE DATOS TREEVIEW
203187 estilo_tabla = ttk .Style ()
204188 estilo_tabla .configure ("Treeview" , font = ('Helvetica' , 10 , 'bold' ), foreground = 'black' , background = 'white' ) #, fieldbackground='yellow'
205189 estilo_tabla .map ('Treeview' ,background = [('selected' , 'DarkOrchid1' )], foreground = [('selected' ,'black' )] )
206190 estilo_tabla .configure ('Heading' ,background = 'white' , foreground = 'navy' ,padding = 3 , font = ('Arial' , 10 , 'bold' ))
207191 estilo_tabla .configure ('Item' ,foreground = 'white' , focuscolor = 'DarkOrchid1' )
208192 estilo_tabla .configure ('TScrollbar' , arrowcolor = 'DarkOrchid1' ,bordercolor = 'black' , troughcolor = 'DarkOrchid1' ,background = 'white' )
209-
210-
211193 #TABLA UNO
212194 self .frame_tabla_uno = Frame (self .frame_dos , bg = 'gray90' )
213195 self .frame_tabla_uno .grid (columnspan = 3 , row = 2 , sticky = 'nsew' )
@@ -286,7 +268,6 @@ def widgets(self):
286268 #TABLA DOS
287269 self .frame_tabla_dos = Frame (self .frame_cinco , bg = 'gray90' )
288270 self .frame_tabla_dos .grid (columnspan = 4 , row = 2 , sticky = 'nsew' )
289-
290271 self .tabla_dos = ttk .Treeview (self .frame_tabla_dos )
291272 self .tabla_dos .grid (column = 0 , row = 0 , sticky = 'nsew' )
292273 ladox = ttk .Scrollbar (self .frame_tabla_dos , orient = 'horizontal' , command = self .tabla_dos .xview )
@@ -301,15 +282,12 @@ def widgets(self):
301282 self .tabla_dos .column ('Modelo' , minwidth = 100 , width = 120 , anchor = 'center' )
302283 self .tabla_dos .column ('Precio' , minwidth = 100 , width = 120 , anchor = 'center' )
303284 self .tabla_dos .column ('Cantidad' , minwidth = 100 , width = 105 , anchor = 'center' )
304-
305285 self .tabla_dos .heading ('#0' , text = 'Codigo' , anchor = 'center' )
306286 self .tabla_dos .heading ('Nombre' , text = 'Nombre' , anchor = 'center' )
307287 self .tabla_dos .heading ('Modelo' , text = 'Modelo' , anchor = 'center' )
308288 self .tabla_dos .heading ('Precio' , text = 'Precio' , anchor = 'center' )
309289 self .tabla_dos .heading ('Cantidad' , text = 'Cantidad' , anchor = 'center' )
310- self .tabla_dos .bind ("<<TreeviewSelect>>" , self .obtener_fila )
311-
312-
290+ self .tabla_dos .bind ("<<TreeviewSelect>>" , self .obtener_fila )
313291 ######################## AJUSTES #################
314292 self .text_ajustes = Label (self .frame_seis , text = 'Configuracion' ,fg = 'purple' , bg = 'white' , font = ('Kaufmann BT' ,28 ,'bold' ))
315293 self .text_ajustes .pack (expand = 1 )
@@ -318,8 +296,6 @@ def widgets(self):
318296 self .texto = Label (self .frame_seis , text = '@autor:Magno Efren \n Desarrollado en Python' ,fg = 'red' , bg = 'white' , font = ('Kaufmann BT' ,18 ))
319297 self .texto .pack (expand = 1 )
320298
321-
322-
323299 def datos_totales (self ):
324300 datos = self .base_datos .mostrar_productos ()
325301 self .tabla_uno .delete (* self .tabla_uno .get_children ())
@@ -328,7 +304,6 @@ def datos_totales(self):
328304 i = i + 1
329305 self .tabla_uno .insert ('' ,i , text = datos [i ][1 :2 ], values = datos [i ][2 :6 ])
330306
331-
332307 def agregar_datos (self ):
333308 codigo = self .codigo .get ()
334309 nombre = self .nombre .get ()
@@ -354,7 +329,6 @@ def actualizar_datos(self):
354329 dato = self .buscar_actualiza .get ()
355330 dato = str ("'" + dato + "'" )
356331 nombre_buscado = self .base_datos .busca_producto (dato )
357-
358332 if nombre_buscado == []:
359333 self .aviso_actualizado ['text' ] = 'No existe'
360334 self .indica_busqueda .update ()
@@ -372,7 +346,6 @@ def actualizar_datos(self):
372346 self .precio .set (nombre_buscado [i ][4 ])
373347 self .cantidad .set (nombre_buscado [i ][5 ])
374348
375-
376349 def actualizar_tabla (self ):
377350 Id = self .id .get ()
378351 codigo = self .codigo .get ()
@@ -386,8 +359,7 @@ def actualizar_tabla(self):
386359 time .sleep (1 )
387360 self .aviso_actualizado ['text' ] = ''
388361 self .limpiar_datos ()
389- self .buscar_actualiza .set ('' )
390-
362+ self .buscar_actualiza .set ('' )
391363 def limpiar_datos (self ):
392364 self .codigo .set ('' )
393365 self .nombre .set ('' )
@@ -399,19 +371,15 @@ def buscar_nombre(self):
399371 nombre_producto = self .buscar .get ()
400372 nombre_producto = str ("'" + nombre_producto + "'" )
401373 nombre_buscado = self .base_datos .busca_producto (nombre_producto )
402-
403374 if nombre_buscado == []:
404375 self .indica_busqueda ['text' ] = 'No existe'
405376 self .indica_busqueda .update ()
406377 time .sleep (1 )
407378 self .indica_busqueda ['text' ] = ''
408-
409379 i = - 1
410380 for dato in nombre_buscado :
411381 i = i + 1
412382 self .tabla_dos .insert ('' ,i , text = nombre_buscado [i ][1 :2 ], values = nombre_buscado [i ][2 :6 ])
413-
414-
415383 def eliminar_fila (self ):
416384 fila = self .tabla_dos .selection ()
417385 if len (fila ) != 0 :
@@ -440,7 +408,6 @@ def obtener_fila(self, event):
440408 data = self .tabla_dos .item (current_item )
441409 self .nombre_borrar = data ['values' ][0 ]
442410
443-
444411if __name__ == "__main__" :
445412 ventana = Tk ()
446413 ventana .title ('' )
@@ -449,91 +416,3 @@ def obtener_fila(self, event):
449416 ventana .call ('wm' , 'iconphoto' , ventana ._w , PhotoImage (file = 'logo.png' ))
450417 app = Ventana (ventana )
451418 app .mainloop ()
452-
453-
454-
455-
456-
457-
458-
459-
460-
461-
462-
463-
464-
465-
466-
467-
468-
469-
470-
471-
472-
473-
474-
475-
476-
477-
478-
479-
480-
481-
482-
483-
484-
485-
486-
487-
488-
489-
490-
491-
492-
493-
494- """
495- # ,highlightbackground='red',highlightcolor='yellow',activebackground='black',activeforeground='deep sky blue' botonnn
496-
497-
498-
499- ventana.wm_attributes("-topmost", True)
500- #Label(self.master, image= self.logo, bg='DarkOrchid1').pack() #,height=150, width=150
501- #Label(self.frame_contenido2, text= 'datos', bg='DarkOrchid1', fg= 'black', font= ('Lucida Sans', 16, 'bold')).grid()
502- #self.entry1 = Entry(self.frame_contenido2, font=('Comic Sans MS', 12),justify = 'center', fg='grey',highlightbackground = "#E65561",
503- #highlightcolor= "green2", highlightthickness=5)
504- #self.entry1.pack(pady=5)
505-
506-
507- #ventana.overrideredirect(1)
508- #ventana.resizable(0,0)
509- #self.master.attributes('-alpha',0.5)
510-
511- mygreen = "black"
512- myred = "black"
513-
514- style = ttk.Style()
515-
516- style.theme_create( "yummy", parent="alt", settings={
517- "TNotebook": {"configure": {"tabmargins": [0, 0, 0, 0] } },
518- "TNotebook.Tab": {
519- "configure": {"padding": [0, 0], "background": mygreen },
520- "map": {"background": [("selected", myred)],
521- "expand": [("selected", [0, 0, 0, 0])] } } } )
522-
523- style.theme_use("yummy")
524-
525-
526-
527-
528- ############################# CREAR PAGINAS ##############################
529- estilo_paginas = ttk.Style()
530- estilo_paginas.configure("TNotebook", background='black', foreground='black', padding=0, borderwidth=0)
531- estilo_paginas.theme_use('default')
532- estilo_paginas.configure("TNotebook", background='black', borderwidth=0)
533- estilo_paginas.configure("TNotebook.Tab", background="black", borderwidth=0)
534- estilo_paginas.map("TNotebook", background=[("selected", 'black')])
535- estilo_paginas.map("TNotebook.Tab", background=[("selected", 'black')], foreground=[("selected", 'black')]);
536- #estilo.configure("TNotebook.Tab", background='red', foreground='red');
537-
538-
539- """
0 commit comments