Canvases not resizable?
S.I.Reynolds at cs.bham.ac.uk
Thu Aug 19 11:30:13 EDT 1999
Are Tkinter canvases fixed to one size? I don't seem to be able to get
them to expand to fill their container when its resized even the though
the canvas pack options are set to fill=BOTH and expand=1.
The example both creates a Frame with a canvas. Resizing the frame
doesn't change the size of the canvas.
from Tkinter import *
"""A Frame containing a Canvas
def __init__(self, w, h):
#Set the frame's width and height
self["width"] = w
self["height"] = h
#Create a red canvas
self.canvas = Canvas(master=self, bg="red")
#Print canvas dimensions when clicked
#These should make the canvas fill the frame right??
def printCanvasSize(self, point):
print 'w = ', self.canvas["width"]
print 'h = ', self.canvas["height"]
if __name__ == '__main__':
cframe = CFrame(w="8i", h="8i")
More information about the Python-list