On Tue, 26 Apr 2005 17:01:46 -0700, James Stroud <[EMAIL PROTECTED]> wrote:
Hello All,
I would like for a tkinter text widget to be aware of how big the frame that
contains it is, then I would like for it to reset its width to the
appropriate number of characters when this frame changes size.
Errr... This is supposed to be the regular behaviour. How do you create
your Text widget? Do you specify a width and height? If you do not, the default
width and height are 80 and 24 respectively, and the widget won't resize to
less than that. If you want a Text widget to be the smallest as possible in its
container, you can do something like:
-----------------------------------------------------
from Tkinter import *
root = Tk()
t = Text(root, width=1, height=1)
t.pack(fill=BOTH, expand=1)
root.geometry('500x200')
root.mainloop()
-----------------------------------------------------
The "trick" is to create the Text as small as possible (width=1, height=1),
make it fill its whole container (pack(fill=BOTH, expand=1)), then set the dimensions for
the container window (geometry('500x200')). You'll get a Text that will shrink and expand
as much as you like.
Is it what you were after?
HTH
--
python -c "print ''.join([chr(154 - ord(c)) for c in
'U(17zX(%,5.zmz5(17;8(%,5.Z65\\'*9--56l7+-'])"
--
http://mail.python.org/mailman/listinfo/python-list