geometry problem with Tkinter

Russell E. Owen owen at nospam.invalid
Wed Nov 13 19:11:32 EST 2002


I've run into a problem displaying a fairly simple geometry;
it displays, but goes into an infinite loop trying to grid everything
(on my display the scroll bar shimmies back and forth a bit and the CPU 
usage is high). Dragging the window to a new size stops it.

Here's a very simplified bit of code that demonstrates the problem (more 
at the end):

from Tkinter import *
root = Tk()

mainFrame = Frame(master = root)

logFrame = Frame(master = mainFrame)

logText = Text(master=logFrame)
logText.grid(row=0, column=0, sticky="nsew")

logScroll = Scrollbar (master = logFrame, orient = "vertical")
logScroll.grid(row=0, column=1, sticky="ns")

logFrame.columnconfigure(0, weight=1)
logFrame.grid(row=0, column=0, sticky="nsew")

mainFrame.columnconfigure(0, weight=1)
mainFrame.grid(row=0, column=0, sticky="nsew")

root.mainloop()

Any idea what, if anything, I am doing wrong, and how best to fix it?

If necessary, I can put everything in one frame, but it ruins a logical 
architecture.

-- Russell

Details:

This is extracted from code that:
- Defines a log widget class that inherits from Frame that contains a 
text widget, scroll bar and some other stuff
- Defines a command/reply widget that also inherits from Frame that 
contains a log widget and a command input field.
Yes I could combine them, but the log widget is useful on its own and 
I'd rather subclass it.

 I've ripped out most or all nonessentials, including:
- rowconfigure commands that are needed for the correct window resize 
behavior
- code to connect the text widget and the scrollbar:

You can leave out the logText (cutting two more lines of code), but that 
makes the window hard to see and the infinite loop so tight that it can 
be hard to abort).



More information about the Python-list mailing list