-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
53 lines (39 loc) · 1.34 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# -*- coding: utf-8 -*-
"""
Entry point of the application.
This module serves as the entry point for the application, initializing the necessary configurations,
and starting the main application window.
@author
Rafał Lewandków (rafal.lewandkow2@uwr.edu.pl)
"""
import os, sys
sys.path.insert(1, "/".join(os.path.realpath(__file__).split("/")[0:-2]))
import tkinter as tk
import config
from app import App
import logging
def main():
"""
Main function to start the application.
This function initializes the logging configuration, creates the Tkinter root window,
and initializes the main application window.
"""
try:
# Initialize logging configuration
config.setup_logging()
logger = logging.getLogger(__name__)
logger.info("Logging is set up.")
# Create the main Tkinter window
root = tk.Tk()
# Initialize and start the main application
App(root)
logger.info("Application started successfully.")
# Start the Tkinter main event loop
root.mainloop()
except Exception as e:
# Log any unhandled exceptions
logger = logging.getLogger(__name__)
logger.critical(f"Unhandled exception in main: {e}")
print(f"Critical error: {e}") # Optional: print error message for debugging
if __name__ == '__main__':
main()