Layout management in tkinter.

Russell E. Owen owen at
Fri Feb 15 17:35:29 CET 2002

In article <a4gj46$1g4g$1 at>,
 Martin Franklin <martin.franklin at>, in response to a 
sequence that started with article <3C6B9001.E5568D2C at>,
 Lukasz Pawelczyk <pawelczyk at> 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
>f.pack(fill='both', expand='yes')
>plik.pack(fill='both', expand='yes')           

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.pack(expand="yes", fill="both")

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