From f0e23167b57f9b942477b6f2b98d84d61dd8e1d7 Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 29 May 2019 22:05:19 +0200 Subject: Main window now inherits tk.Tk instead of compositing it, to be able to be referenced as winfo_toplevel() --- jfr_playoff/gui/__init__.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'jfr_playoff/gui') diff --git a/jfr_playoff/gui/__init__.py b/jfr_playoff/gui/__init__.py index d9c455d..79a1fad 100644 --- a/jfr_playoff/gui/__init__.py +++ b/jfr_playoff/gui/__init__.py @@ -3,14 +3,15 @@ from tkinter import ttk from .tabs import * -class PlayoffGUI(object): +class PlayoffGUI(tk.Tk): def __init__(self): - self.root = tk.Tk() + tk.Tk.__init__(self) + self.tabs = {} def run(self): - self.notebook = ttk.Notebook(self.root) + self.notebook = ttk.Notebook(self) self.notebook.pack(fill=tk.BOTH, expand=True) for tab in tabs.__all__: - tabObj = globals()[tab](self.notebook) - self.notebook.add(tabObj, text=tabObj.title) - self.root.mainloop() + self.tabs[tab] = globals()[tab](self.notebook) + self.notebook.add(self.tabs[tab], text=self.tabs[tab].title) + self.mainloop() -- cgit v1.2.3