Layout management in tkinter.
Russell E. Owen
owen at xastrox.xwashingtonx.edu.invalid
Fri Feb 15 11:35:29 EST 2002
In article <a4gj46$1g4g$1 at mail1.wg.waii.com>,
Martin Franklin <martin.franklin at westgeo.com>, in response to a
sequence that started with article <3C6B9001.E5568D2C at lucent.com>,
Lukasz Pawelczyk <pawelczyk at lucent.com> wrote:
>I have noticed Tkinter hanging when I (by mistake) pack and grid widgets
>into the same parent! You don't seem to be doing this however the
>ScrolledText widget uses a frame widget 'under the covers and this uses
>pack to 'pack' the scrollbar. the grid() call to the scrolledtext widget
>is passed to this frame widget therefore without knowing it you are trying
>to pack and grid widgets into the same parent!.....
>
>
>This is what I came up with :-
>
>from Tkinter import *
>from ScrolledText import ScrolledText
>
>
>main=Tk()
>
>f=Frame(main)
>f.pack(fill='both', expand='yes')
>
>...
>plik=ScrolledText(main,background="grey")
>plik.pack(fill='both', expand='yes')
>
>main.mainloop()
A follow-up comment: if this is the problem, you can still grid the
widgets by making a separate frame for the ScrolledText widget, pack the
ScrolledText into that frame and grid the frame. Something like:
scframe = Frame(main)
plik=ScrolledText(scframe...)
plik.pack(expand="yes", fill="both")
scframe.grid(...)
Also, ScrolledText is broken. It should return a frame containing the
widgets, precisely so this kind of problem doesn't happen.
-- Russell
--
Return owen
address astro
garbled washington
in header edu
More information about the Python-list
mailing list