Prevent Tkinter Canvas from resizing

Fredrik Lundh fredrik at pythonware.com
Fri Jan 20 02:07:57 EST 2006


Eric Wong wrote:

> Using Tkinter, I have a Canvas with vertical Scrollbar attached.  At
> runtime, I dynamically create Checkboxes on the Canvas, each one on a
> different row.  When I add a lot of Checkboxes, instead of the
> scrollbar kicking in, the Canvas resizes and subsequently, my
> Application window resizes such that it is larger than my monitor.
>
> Can I prevent the Canvas from resizing when I am creating widgets on it
> at runtime?  I want to use the scrollbars when there are more
> Checkboxes than will fit on the visible Canvas.  Is this possible?

if you want scrolling widgets, you need to create the widgets *in* the
canvas (using create_window), rather than on top of the canvas (using
the canvas as the master).

</F>






More information about the Python-list mailing list