diff --git a/src/main.py b/src/main.py index f6039d6..b0014fe 100644 --- a/src/main.py +++ b/src/main.py @@ -67,6 +67,29 @@ class MedTrackerApp: # Add menu bar self._setup_menu() + # Center the window on screen + self._center_window() + + def _center_window(self) -> None: + """Center the main window on the screen.""" + # Update the window to get accurate dimensions + self.root.update_idletasks() + + # Get window dimensions + window_width = self.root.winfo_reqwidth() + window_height = self.root.winfo_reqheight() + + # Get screen dimensions + screen_width = self.root.winfo_screenwidth() + screen_height = self.root.winfo_screenheight() + + # Calculate position to center the window + x = (screen_width // 2) - (window_width // 2) + y = (screen_height // 2) - (window_height // 2) + + # Set the window geometry + self.root.geometry(f"{window_width}x{window_height}+{x}+{y}") + def _setup_main_ui(self) -> None: """Set up the main UI components.""" import tkinter.ttk as ttk