G
Gary Richardson
Is there a simple way of causing the size of a canvas to change as the
window is resized when using the Grid geometry manager? Setting
sticky='NESW', as in the following code, doesn't work though the
documentation for Grid seems to imply that it should: "sticky If a
slave's cell is larger than its requested dimensions, this option may be
used to position (or stretch) the slave within its cell. ... The sticky
option subsumes the combination of anchor and fill that is used by
pack". Or is there something wrong with my code?
Thanks,
Gary Richardson
from Tkinter import *
class Test(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
frame = Frame(parent)
self.canvas = Canvas(frame, bg='white' , width=300, height=100)
self.canvas.grid(row=0, column=0, sticky='NESW')
frame.grid()
root = Tk()
Test(root)
root.mainloop()
window is resized when using the Grid geometry manager? Setting
sticky='NESW', as in the following code, doesn't work though the
documentation for Grid seems to imply that it should: "sticky If a
slave's cell is larger than its requested dimensions, this option may be
used to position (or stretch) the slave within its cell. ... The sticky
option subsumes the combination of anchor and fill that is used by
pack". Or is there something wrong with my code?
Thanks,
Gary Richardson
from Tkinter import *
class Test(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
frame = Frame(parent)
self.canvas = Canvas(frame, bg='white' , width=300, height=100)
self.canvas.grid(row=0, column=0, sticky='NESW')
frame.grid()
root = Tk()
Test(root)
root.mainloop()