tags:

views:

28

answers:

1

I'm using Python and Tkinter, and I need to know the current dimensions (width, height) of a widget.

I've tried somewidget["width"], but it returns only a fixed value, and is not updated whenever the widget size changes (e.g. when the window is resized).

+2  A: 

Use somewidget.winfo_width() and somewidget.winfo_height() to get the actual widget size, the somewidget['width'] property is only a hint given to the geometry manager.

Lie Ryan
I think you mean "geometry manager", instead of "window manager". And thanks!
Denilson Sá