Tkinter - getting canvas window size

Rick Pasotto rickp at telocity.com
Tue Sep 18 18:08:39 EDT 2001


On Tue, 18 Sep 2001 17:41:51 GMT in comp.lang.python, Fredrik Lundh
wrote:
> Rick Pasotto wrote:
> > Why do the print statements in the following program show zero?
> 
> "cget" returns the option value as specified (or in this case, the
> default value), not the actual size.

How do I get the actual size? The packed label might or might not
contain a nl. I don't necessarily know the font size. I need to know
the height of the frame (inside the canvas.create_window()) so I can
position another one underneath it.

> > How can I figure out the size of the frame?
> 
> Use winfo_width/height (current size) or winfo_reqwidth/reqheight
> (requested size).  the latter is usually what you want.

This always gives '1' as an answer no matter the actual size. 
winfo_geometry also always gives 1x1+0+0.

How do I get this to work with the integer that canvas.create_window()
returns?

> more info here:
> 
> http://www.pythonware.com/library/tkinter/introduction/basic-widget-methods.htm
> => Window Related Information

This is not helping me for widgets placed on a canvas.

-- 
How could men dream of blaming themselves for their woes when they
have been persuaded that by nature they are inert, that the source
of all action, and consequently of all responsibility, lies outside
themselves, in the will of the sovereign and of the lawgiver?
	-- Frédéric Bastiat (1801-1850)
   Rick Pasotto    rickp at telocity.com    http://www.niof.net



More information about the Python-list mailing list