Easy.
This commit is contained in:
Simon Forman 2024-04-13 21:38:56 -07:00
parent f40d466df1
commit 0e0117e6be
1 changed files with 15 additions and 2 deletions

17
ui.py
View File

@ -30,10 +30,20 @@ class App:
'''
def __init__(self, master=None, *canvas_args, **canvas_kw):
frame = self.frame = Frame(root, background='green')
notebook = self.notebook = Notebook(master)
notebook.enable_traversal()
frame = self.frame = Frame(None, background='green')
# When putting a frame into a Notebook you use the add() method.
# but what should the parent of the frame be? The Notebook?
frame.rowconfigure(0, weight=1)
frame.columnconfigure(0, weight=1)
frame.pack(expand=True, fill=BOTH)
# When putting a frame into a Notebook you evidently don't need
# to pack() it. Maybe because of the weights? I'm not setting
# the sticky arg to Notebook.add().
#frame.pack(expand=True, fill=BOTH)
canvas = self.canvas = Canvas(frame, *canvas_args, **canvas_kw)
@ -57,6 +67,9 @@ class App:
canvas.bind("<Configure>", self.handle_canvas_resize)
notebook.add(frame, text='Star Map', underline=5)
notebook.pack(expand=True, fill=BOTH)
def handle_canvas_resize(self, event):
print(event)