Compare commits

...

2 Commits

Author SHA1 Message Date
Dennis Eckerskorn e58518327e Frame works 2024-11-26 20:53:26 +01:00
Dennis Eckerskorn 8b2476eeeb Windows opens 2024-11-26 19:17:50 +01:00
7 changed files with 21 additions and 20 deletions

11
main.py
View File

@ -1,11 +0,0 @@
from MutiFunctionProgramProject.ui.centered_window import CenteredWindow
def main():
# Crear una instancia de la ventana centrada
app = CenteredWindow(title="Ventana Principal", width_percentage=0.75, height_percentage=0.75)
# Ejecutar la ventana
app.mainloop()
if __name__ == "__main__":
main()

11
src/main.py Normal file
View File

@ -0,0 +1,11 @@
from ui.centered_window import CenteredWindow
def main():
# Crear una instancia de la ventana centrada
app = CenteredWindow()
# Ejecutar la ventana
app.mainloop()
if __name__ == "__main__":
main()

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)
# Obtener la resolucion de la pantalla:
screen_width = self.winfo.screenwidth()
screen_height = self.winfo.screenheight()
screen_width = self.winfo_screenwidth()
screen_height = self.winfo_screenheight()
# Calcula el tamaño de la ventana según procentaje de la pantalla:
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}")
#Configura la ventana (fuera del constructor)
self.configure_window()
def configure_window(self):
# Configuraciones adicionales:
self.configure(bg_color="lightgray")
def configure_window(self):
# Configuraciones adicionales:
self.configure(bg_color="lightgray")
# Ejemplo de añadir un botón
btn = ctk.CTkButton(self, text="Haz clic aquí", command=self.on_button_click)
btn.pack(pady=20)
btn = ctk.CTkButton(self, text="Haz clic aquí", command=self.on_button_click)
btn.pack(pady=20)
def on_button_click(self):
print("¡Botón clickeado!")
def on_button_click(self):
print("¡Botón clickeado!")