Windows opens

This commit is contained in:
Dennis Eckerskorn 2024-11-26 19:17:50 +01:00
parent ccae883f17
commit 8b2476eeeb
6 changed files with 11 additions and 10 deletions

View File

@ -1,4 +1,4 @@
from MutiFunctionProgramProject.ui.centered_window import CenteredWindow from ui.centered_window import CenteredWindow
def main(): def main():
# Crear una instancia de la ventana centrada # Crear una instancia de la ventana centrada

0
src/ui/__init__.py Normal file
View File

Binary file not shown.

Binary file not shown.

View File

@ -9,8 +9,8 @@ class CenteredWindow(ctk.CTk):
self.title(title) self.title(title)
# Obtener la resolucion de la pantalla: # Obtener la resolucion de la pantalla:
screen_width = self.winfo.screenwidth() screen_width = self.winfo_screenwidth()
screen_height = self.winfo.screenheight() screen_height = self.winfo_screenheight()
# Calcula el tamaño de la ventana según procentaje de la pantalla: # Calcula el tamaño de la ventana según procentaje de la pantalla:
window_width = int(screen_width * width_percentage) window_width = int(screen_width * width_percentage)
@ -22,17 +22,18 @@ class CenteredWindow(ctk.CTk):
self.geometry(f"{window_width}x{window_height}+{position_x}+{position_y}") self.geometry(f"{window_width}x{window_height}+{position_x}+{position_y}")
#Configura la ventana (fuera del constructor)
self.configure_window() self.configure_window()
def configure_window(self): def configure_window(self):
# Configuraciones adicionales: # Configuraciones adicionales:
self.configure(bg_color="lightgray") self.configure(bg_color="lightgray")
# Ejemplo de añadir un botón # Ejemplo de añadir un botón
btn = ctk.CTkButton(self, text="Haz clic aquí", command=self.on_button_click) btn = ctk.CTkButton(self, text="Haz clic aquí", command=self.on_button_click)
btn.pack(pady=20) btn.pack(pady=20)
def on_button_click(self): def on_button_click(self):
print("¡Botón clickeado!") print("¡Botón clickeado!")