feat: Center main window on screen during initialization
Some checks failed
Build and Push Docker Image / build-and-push (push) Has been cancelled

This commit is contained in:
William Valentin
2025-08-01 13:05:24 -07:00
parent 14d9943665
commit 41d91d9c30

View File

@@ -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