import tkinter as tk import threading import datetime from tkinter import Menu, ttk # Importación de widgets personalizados from hilos.ChatWidget import ChatWidget from hilos.MusicPlayer import MusicPlayer from hilos.WeatherWidget import WeatherWidget from hilos.SystemMonitor import SystemMonitor from hilos.ApplicationLauncher import ApplicationLauncher from hilos.LanguageChart import LanguageChart # Crear la ventana principal root = tk.Tk() root.title("Ventana Responsive") root.geometry("1000x700") # Tamaño inicial # Crear el menú superior menu_bar = Menu(root) root.config(menu=menu_bar) # Frames laterales y central frame_izquierdo = tk.Frame(root, bg="lightblue", width=150) frame_central = tk.Frame(root, bg="white") frame_derecho = tk.Frame(root, bg="lightgreen", width=150) frame_izquierdo.grid(row=0, column=0, sticky="ns") frame_central.grid(row=0, column=1, sticky="nsew") frame_derecho.grid(row=0, column=2, sticky="ns") # Añadir widgets a los paneles weather_widget = WeatherWidget(frame_izquierdo, "API_KEY") app_launcher = ApplicationLauncher(frame_izquierdo) language_chart = LanguageChart(frame_izquierdo) chat_widget = ChatWidget(frame_derecho) music_player = MusicPlayer(frame_derecho) # Barra de estado barra_estado = tk.Label(root, text="Barra de estado", bg="lightgray", anchor="w") barra_estado.grid(row=1, column=0, columnspan=3, sticky="ew") # Inicializar el monitor del sistema stop_event = threading.Event() system_monitor = SystemMonitor(barra_estado, stop_event) # Manejar el cierre de la aplicación def on_closing(): stop_event.set() root.destroy() root.protocol("WM_DELETE_WINDOW", on_closing) root.mainloop()