Notebook
Easy.
This commit is contained in:
@@ -30,10 +30,20 @@ class App:
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, master=None, *canvas_args, **canvas_kw):
|
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.rowconfigure(0, weight=1)
|
||||||
frame.columnconfigure(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)
|
canvas = self.canvas = Canvas(frame, *canvas_args, **canvas_kw)
|
||||||
|
|
||||||
@@ -57,6 +67,9 @@ class App:
|
|||||||
|
|
||||||
canvas.bind("<Configure>", self.handle_canvas_resize)
|
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):
|
def handle_canvas_resize(self, event):
|
||||||
print(event)
|
print(event)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user