|
| 1 | +import tkinter as tk |
| 2 | +from tkinter import ttk |
| 3 | +import util.util_ventana as util_ven |
| 4 | +from PIL import Image, ImageTk, ImageDraw |
| 5 | +import util.util_imagenes as util_img |
| 6 | +import config as conf |
| 7 | + |
| 8 | + |
| 9 | +class FormMestroDesign(tk.Tk): |
| 10 | + |
| 11 | + def __init__(self) -> None: |
| 12 | + super().__init__() |
| 13 | + self.qr_guardado = None |
| 14 | + self.qr_img_base = util_img.leer_imagen("./imagenes/qr_base.png", (330, 330)) |
| 15 | + self.qr_mensaje = util_img.leer_imagen("./imagenes/escanea_me.png", (300, 200)) |
| 16 | + self.config_window() |
| 17 | + self.paneles() |
| 18 | + self.widget_panel_superior() |
| 19 | + self.widget_panel_inferior() |
| 20 | + |
| 21 | + def config_window(self): |
| 22 | + self.title('QR Diseño de Código') |
| 23 | + self.iconbitmap("./imagenes/logo.ico") |
| 24 | + w, h = 800, 450 |
| 25 | + util_ven.centrar_ventana(self, w, h) |
| 26 | + |
| 27 | + def paneles(self): |
| 28 | + |
| 29 | + self.barra_superior = tk.Frame(self,) |
| 30 | + self.barra_superior.pack(side=tk.TOP, fill='both', expand=True) |
| 31 | + |
| 32 | + self.barra_superior_izq = tk.Frame( |
| 33 | + self.barra_superior, bg=conf.COLOR_BARRA_SUPERIOR_IZQ) |
| 34 | + self.barra_superior_izq.pack(side=tk.LEFT, fill='both', expand=True) |
| 35 | + self.barra_superior_der = tk.Frame( |
| 36 | + self.barra_superior, bg=conf.COLOR_BARRA_SUPERIOR_DER) |
| 37 | + self.barra_superior_der.pack(side=tk.RIGHT, fill='both', expand=True) |
| 38 | + |
| 39 | + self.barra_inferior = tk.Frame( |
| 40 | + self, bg=conf.COLOR_BARRA_INFERIOR, height=50) |
| 41 | + self.barra_inferior.pack(side=tk.BOTTOM, fill='x', expand=False) |
| 42 | + |
| 43 | + def widget_panel_superior(self): |
| 44 | + |
| 45 | + self.labelTitulo = tk.Label( |
| 46 | + self.barra_superior_izq, text="QR Diseño de Código", bg=conf.COLOR_BARRA_SUPERIOR_IZQ) |
| 47 | + self.labelTitulo.config(fg="#000000", font=( |
| 48 | + "Roboto", 18, "bold"), pady=10, width=16) |
| 49 | + self.labelTitulo.pack(side=tk.TOP, expand=False, pady=20) |
| 50 | + |
| 51 | + estilo = ttk.Style() |
| 52 | + estilo.configure("EstiloEntry.TEntry", padding=( |
| 53 | + 10, 5, 10, 5), relief="flat") |
| 54 | + |
| 55 | + self.entrada_texto = ttk.Entry( |
| 56 | + self.barra_superior_izq, width=50, style="EstiloEntry.TEntry") |
| 57 | + self.entrada_texto.pack(side=tk.TOP, expand=False, pady=20) |
| 58 | + |
| 59 | + self.placeholder_text = "https://autodidacta.mx/" |
| 60 | + self.entrada_texto.insert(0, self.placeholder_text) |
| 61 | + self.entrada_texto.bind("<FocusIn>", self.on_entry_focus_in) |
| 62 | + self.entrada_texto.bind("<FocusOut>", self.on_entry_focus_out) |
| 63 | + |
| 64 | + self.etiqueta_mensaje = ttk.Label(self.barra_superior_izq, image=self.qr_mensaje, border=100) |
| 65 | + self.etiqueta_mensaje.pack(side=tk.TOP, expand=True, pady=20, padx=20) |
| 66 | + |
| 67 | + self.etiqueta_qr = ttk.Label(self.barra_superior_der,image=self.qr_img_base) |
| 68 | + self.etiqueta_qr.pack(side=tk.TOP, expand=True, pady=20, padx=20) |
| 69 | + |
| 70 | + |
| 71 | + def on_entry_focus_in(self, event): |
| 72 | + pass |
| 73 | + |
| 74 | + def on_entry_focus_out(self, event): |
| 75 | + pass |
| 76 | + |
| 77 | + def widget_panel_inferior(self): |
| 78 | + |
| 79 | + self.boton_generar = tk.Button(self.barra_inferior, text="Generar Codigo", width=15, height=2, |
| 80 | + bg=conf.COLOR_BOTON, fg=conf.COLOR_TEXTO_BOTON, relief=tk.FLAT, padx=5, pady=5, bd=0, borderwidth=0, highlightthickness=0, |
| 81 | + overrelief='flat', command=self.on_button_click_mostrar_qr) |
| 82 | + self.boton_generar.pack(side=tk.RIGHT, expand=False, padx=10, pady=10) |
| 83 | + |
| 84 | + self.boton_descargar = tk.Button(self.barra_inferior, text="Descargar Codigo", width=15, height=2, |
| 85 | + bg=conf.COLOR_BOTON, fg=conf.COLOR_TEXTO_BOTON, relief=tk.FLAT, padx=5, pady=5, bd=0, borderwidth=0, highlightthickness=0, |
| 86 | + overrelief='flat', command=self.on_button_click_guardar_qr) |
| 87 | + self.boton_descargar.pack( |
| 88 | + side=tk.RIGHT, expand=False, padx=10, pady=10) |
| 89 | + |
| 90 | + def on_button_click_mostrar_qr(self): |
| 91 | + pass |
| 92 | + |
| 93 | + def on_button_click_guardar_qr(self): |
| 94 | + pass |
0 commit comments