diff --git a/pomodorodiscord/src/app.py b/pomodorodiscord/src/app.py index 6bc0e50..7b2c80e 100644 --- a/pomodorodiscord/src/app.py +++ b/pomodorodiscord/src/app.py @@ -6,7 +6,7 @@ class TabView(ctk.CTkTabview): def __init__(self, master, **kwargs): - super().__init__(master, **kwargs) + super().__init__(master, **kwargs, command=self.on_tab_change) self.add("Main") self.add("Settings") self.add("Stats") @@ -20,6 +20,15 @@ def __init__(self, master, **kwargs): self.stats_frame = StatsFrame(self.tab("Stats")) self.stats_frame.pack(expand=True, fill='both') + # Fixing scrolling on Linux + # https://github.com/TomSchimansky/CustomTkinter/issues/1356 + self.stats_frame.bind_all("", lambda e: [frame._parent_canvas.yview("scroll", -1, "units") for frame in (self.stats_frame, self.settings_frame)]) + self.stats_frame.bind_all("", lambda e: [frame._parent_canvas.yview("scroll", 1, "units") for frame in (self.stats_frame, self.settings_frame)]) + + def on_tab_change(self): + if self.get() == "Stats": + self.stats_frame.load_stats() + class PomodoroApp(ctk.CTk): WIDTH = 350