Canvases not resizable?

Dr. Peter Stoehr peter.stoehr at weihenstephan.org
Thu Aug 19 21:02:22 CEST 1999


Hi Stuart,

Stuart Reynolds wrote:

> 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.
No, canvases are resizeable.

from Tkinter import *
mFrame = Frame(master=None)
mFrame.pack(fill=BOTH, expand=1)
canvas = Canvas(master=mFrame, bg="red")
canvas.pack(fill=BOTH, expand=1)
mFrame.mainloop()

The tricky part is where and when to use the correct options for the
packer. In your example, the frame was not resizeable, thus the canvas
was not resizeable.

Peter

-- 
---------------------------------------------------------------------------
   Dr. Peter Stoehr --- Teisenbergweg 6 --- 85435 Erding --- 08122/47232
---------------------------------------------------------------------------
		I'm the terror that flaps through the night




More information about the Python-list mailing list