Layout management in tkinter.

Eric Brunel eric.brunel at pragmadev.com
Thu Feb 14 07:43:21 EST 2002


Hi Lukasz,

Lukasz Pawelczyk wrote:
> Hello,
> 
> I try to change the geometry manager pack into grid in the code
> and I have problem.
> Why it does not work?
> 
> prz1=Button(main,text="Otworz",cursor="question_arrow",command=otworz)
> prz1.grid(row=0)
> 
> prz2=Button(main,text="Zachowaj",cursor="dot",command=zachowaj)
> prz2.grid(row=0,column=1)
> 
> prz3=Button(main,text="Zamknij",cursor="pirate",command=wyjscie)
> prz3.grid(row=0,column=2)
> 
> plik=ScrolledText(main,background="grey")
> plik.grid(row=1,column=0,columnspan=3)                - there the code stop

You didn't mention where you got the ScrolledText widget, but apparently 
you did a "from ScrolledText import ScrolledText", isn't it? If it is, I do 
have the same problem: apparently, the creation or gridding of the 
ScrolledText tries to pack something in the "main" widget, which results in 
program hanging.

I would advise not to use the ScrolledText widget from the ScrolledText 
module since it is obviously not so well designed... Either use the Text 
and Scrollbar widgets from Tkinter (you'll have to bind them to each other 
explicitely, but it's quite easy), or use the ScrolledText widget 
from PMW (Python MegaWidgets) that you'll find at:
http://pmw.sourceforge.net/
You'll also find in PMW a great deal of other very useful widgets.

HTH
 - eric -



More information about the Python-list mailing list