Tkinter Grid manager question

Gabe Newcomb Gabe.Newcomb at noetix.com
Tue Jul 23 22:04:52 EDT 2002


Basically put, I have 3 frames in a single root window, each one has
been created using the widget.grid statement like so:

f1 = Frame(root,height=80,width=900,bg='lightyellow')
f1.grid(row=0,sticky=E+W)
f2 = Frame(root,height=550,width=900,bg='lightyellow')
f2.grid(row=1,sticky=E+W)
f3 = Frame(root,height=100,width=900,bg='lightyellow')
f3.grid(row=2,sticky=E+W)

after this, I want to stick four different widgets alongside each other
in the first frame (f1). 

Within this first frame, I create 4 sub frames, all this way
('app_width' is the total width of the 
root window, in this case 900).

f1_1 = Frame(f1,height=80,width=int(app_width/4), bg='lightyellow')
f1_1.grid(row=0,column=0,sticky=W+E)
f1_2 = Frame(f1,height=80,width=int(app_width/4), bg='lightyellow')
f1_2.grid(row=0,column=1,sticky=W+E)
f1_3 = Frame(f1,height=80,width=int(app_width/4), bg='lightyellow')
f1_3.grid(row=0,column=2,sticky=W+E)
f1_4 = Frame(f1,height=80,width=int(app_width/4), bg='lightyellow')
f1_4.grid(row=0,column=3,sticky=W+E)

Now, when I put widgets in these frames, it becomes apparent that the
frames aren't really 225 pixels wide. It's very difficult for me to make
things look nice.

Anybody have any tips on what I'm doing? Are the frames' widths being
overridden by the small size of the widget each one might contain?

Thanks in advance!

Gabe




More information about the Python-list mailing list