Tkinter: How do I change the actual width of a widget?

Fredrik Lundh fredrik at pythonware.com
Sat Nov 11 03:05:45 EST 2006


Mudcat wrote:

> I am trying to change the width of a widget based on pixel size and not
> on characters. I can't figure out how to do this.
> 
> Normally to change to the size of a widget it looks like:
> 
> widget.configure(width = x)
> 
> However that is in characters, not in pixels. To retrieve the actual
> size of a widget, I believe it is done with:
> 
> x = widget.winfo_width()
> 
> Obviously that value can not be used in the configure statement. Is
> there a way to dynamically change the width (and height) of a widget
> using the winfo data?

look for "pack_propagate" on this page for one way to do it:

     http://effbot.org/tkinterbook/button.htm

</F>




More information about the Python-list mailing list