#50 - linked main.py with Session_dashboard.py#70
Conversation
Gagandeep-2003
left a comment
There was a problem hiding this comment.
- Entry Point Guard
Right now, the Tk window is created on import. Please wrap the launch in a main() function and add an import guard:
def main():
root = tk.Tk()
root.geometry(WINDOW_SIZE)
root.title(APP_TITLE)
notebook = ttk.Notebook(root)
live_track = ttk.Frame(notebook)
session_his = ttk.Frame(notebook)
notebook.add(live_track, text="Live Tracking")
notebook.add(session_his, text="Session History")
notebook.pack(expand=True, fill="both")
root.mainloop()
if name == "main":
main()
- Avoid Wildcard Imports
Instead of:
from tkinter.ttk import *
Use explicit imports:
import tkinter as tk
from tkinter import ttk
- Structure for Future Work
Since more functionality will be added in #50, consider using a class or at least helper methods for each tab. Example:
def build_live_tracking_tab(parent):
frame = ttk.Frame(parent, padding=10)
ttk.Label(frame, text="Live Tracking — TODO").pack(anchor="w")
return frame
- Widget Packing
Use expand=True, fill="both" when packing the notebook so it resizes properly:
notebook.pack(expand=True, fill="both")
- Code Style / Maintainability
Add constants instead of hardcoding values:
WINDOW_SIZE = "600x400"
APP_TITLE = "Session Analysis"
Also add small docstrings or # TODO comments inside tabs so contributors know where to extend.
✅ With these changes, the app will be safer to import, resize correctly, and easier for contributors to extend.
Working on #50
Session.py will run from main.py
yet need to work on session_analysis.py, just making 1 step forward in #50.
In future many functions are going to be included in analysis file.
for now its just a blank tkinter GUI for other candidate to work on that.