import customtkinter as ctk from database import Database from datetime import date from tkinter import messagebox class ExerciseDiaryApp(ctk.CTk): def __init__(self): super().__init__() self.title("Exercise Diary - Level Sub-0") self.geometry("1000x700") self.db = Database() self.current_date = date.today().isoformat() self.grid_columnconfigure(1, weight=1) self.grid_rowconfigure(0, weight=1) # Sidebar self.sidebar_frame = ctk.CTkFrame(self, width=200, corner_radius=0) self.sidebar_frame.grid(row=0, column=0, sticky="nsew") self.sidebar_frame.grid_rowconfigure(5, weight=1) self.logo_label = ctk.CTkLabel(self.sidebar_frame, text="My Diary", font=ctk.CTkFont(size=20, weight="bold")) self.logo_label.grid(row=0, column=0, padx=20, pady=(20, 10)) self.btn_dashboard = ctk.CTkButton(self.sidebar_frame, text="Dashboard", command=self.show_dashboard) self.btn_dashboard.grid(row=1, column=0, padx=20, pady=10) self.btn_daily = ctk.CTkButton(self.sidebar_frame, text="Daily Log", command=self.show_daily_log) self.btn_daily.grid(row=2, column=0, padx=20, pady=10) self.btn_workout = ctk.CTkButton(self.sidebar_frame, text="Workouts", command=self.show_workout_log) self.btn_workout.grid(row=3, column=0, padx=20, pady=10) self.btn_stats = ctk.CTkButton(self.sidebar_frame, text="Progress", command=self.show_stats) self.btn_stats.grid(row=4, column=0, padx=20, pady=10) # Main Content Area self.main_frame = ctk.CTkFrame(self, corner_radius=0, fg_color="transparent") self.main_frame.grid(row=0, column=1, sticky="nsew", padx=20, pady=20) # Default View self.show_dashboard() def clear_main_frame(self): for widget in self.main_frame.winfo_children(): widget.destroy() def show_dashboard(self): self.clear_main_frame() from ui.dashboard import DashboardFrame frame = DashboardFrame(self.main_frame, self.db) frame.pack(fill="both", expand=True) def show_daily_log(self): self.clear_main_frame() from ui.daily_log import DailyLogFrame frame = DailyLogFrame(self.main_frame, self.db, self.current_date) frame.pack(fill="both", expand=True) def show_workout_log(self): self.clear_main_frame() from ui.workout import WorkoutFrame frame = WorkoutFrame(self.main_frame, self.db, self.current_date) frame.pack(fill="both", expand=True) def show_stats(self): self.clear_main_frame() from ui.stats import StatsFrame frame = StatsFrame(self.main_frame, self.db) frame.pack(fill="both", expand=True)