Resizing widgets in text windows

Eric Brunel eric_brunel at despammed.com
Wed Jan 31 09:47:48 CET 2007


On Tue, 30 Jan 2007 23:13:07 +0100, <deacon.sweeney at gmail.com> wrote:
> I'm using a text widget to hold a set of plots, one plot per line,
> such that the scrolling capability of the text widget can be taken
> advantage of to display only a subset of the plots at any given time.
> In the analyses my program automates, there are at least several plots
> are typically loaded into the text widget. This works out splendidly,
> but the width of the plots has thus far been a static thing. Now, I'll
> be able to adjust the plots widths so that when the owner window is
> resized, the width of each plot in the text widget is adjusted and the
> plot continues to occupy the entire text widget but no more, making
> for a much more professional looking product.

IMHO, "abusing" the text widget to do that is quite likely to cause  
problems in the future. For this use case, I would have used a Canvas with  
scrollbars containing a Frame where the plots are packed or gridded  
vertically. The Canvas's scrollregion should then be adjusted each time a  
plot is added, removed or resized, and you'd still have to use the  
<Configure> event to resize the Frame to the Canvas's width. But at least,  
that's what Canvases and Frames are for; the Text widget is for... well,  
displaying text. Also note that Pmw (http://pmw.sourceforge.net/) has a  
ScrolledFrame megawidget that just does what you want.

> Muchas gracias.

You're welcome.

HTH again...
-- 
python -c "print ''.join([chr(154 - ord(c)) for c in  
'U(17zX(%,5.zmz5(17l8(%,5.Z*(93-965$l7+-'])"



More information about the Python-list mailing list