[Tkinter-discuss] Force a Frame and/or Text widget to a specific width?

python at bdurham.com python at bdurham.com
Tue Dec 7 17:36:02 CET 2010


Apologies for the poorly worded description below.

I *can* set my Text widget to a specific width. What I would like
to do is set my Text widget to a specific width, have it do its
layout with word wrap, then remove the width property so that the
Text widget can resize as its parent container resizes.

Is this possible?

Thank you,
Malcolm

----- Original message -----
From: python at bdurham.com
To: "Python-Tkinter" <tkinter-discuss at python.org>
Date: Tue, 07 Dec 2010 11:07:43 -0500
Subject: [Tkinter-discuss] Force a Frame and/or Text widget to a
specific width?

Is there a technique where I can force a Frame and/or Text widget
to a specific width? I understand that width= many times only
serves as a hint to Tkinter's layout managers. I'm looking for a
width setting technique that's much more forceful than a
suggestion :)

I'm using a Text widget with wrap='word' as a multi-line label. I
pack this Text widget into a Frame.

This Text widget wants to grow to a certain width inspite of
setting a specific (char) width for Text and a specific (pixel)
width for its parent Frame.

The only way I can control my Text widget's width is by placing
it in a window with a max width set via .maxsize( width, ... )
and resizing disabled via resizable( False, False ).

If I skip the resizable( False, False ) statement, then I get the
proper sized Text/Frame *until* I go to resize my window ... as
soon as I go to resize my window, it snaps to the width it wants
to go to when I don't force maxsize().

BTW: I'm using 32-bit Python 2.7 for Windows.

Am I missing something obvious?

Thanks,
Malcolm
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss at python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20101207/04087d83/attachment.html>


More information about the Tkinter-discuss mailing list