time_logix/main.py
Blake Ridgway 1231673385 refactor: Create main.py as entry point, implement on close
This commit creates a dedicated entry point `main.py`, instantiates
the application components, and handles the WM_DELETE_WINDOW protocol.

- Removed window creation and mainloop from previous file.
- Created a dedicated entry point with basic error handling.
- Implemented an on_closing protocol to properly close db and exit application
- Implemented the loading of database objects.
2025-04-05 18:03:52 -05:00

22 lines
478 B
Python

import sys
from database import Database
from pdf_exporter import PDFExporter
from ui.main_window import MainWindow
def main():
db = Database()
pdf_exporter = PDFExporter()
app = MainWindow(db, pdf_exporter)
def on_closing():
db.close()
app.destroy() # Properly destroy the Tkinter window
sys.exit()
app.protocol("WM_DELETE_WINDOW", on_closing) # Handle window closing
app.mainloop()
if __name__ == "__main__":
main()