Tkinter Frame Size

James Stroud jstroud at mbi.ucla.edu
Fri Oct 28 16:45:39 EDT 2005


On Friday 28 October 2005 11:00, Tuvas wrote:
> Okay. I have alot of items that are put on the basic frame already,
> using a grid method. Will this change anything?

It shouldn't. For example

from Tkinter import *
app = Tk()
app.geometry("%dx%d%+d%+d" % (600, 400, 0, 0))
f = Frame(app)
f.pack()
L1 = Label(f, text="Bob & Carol & Ted & Alice")
L1.grid(row=0, column=0, columnspan=2)
L2 = Label(f, text="Barney")
L2.grid(row=1, column=0)
L3 = Label(f, text="Betty")
L3.grid(row=1, column=1)
app.mainloop()

Just grid everything in the frame then pack the frame in the Tk(). However do 
not mix grid and pack in the same frame or it will lock up your app. E.g. 
*dont* do this:

   L1 = Label(f, text="Bob & Carol & Ted & Alice")
   L1.grid(row=0, column=0, columnspan=2)
   L2 = Label(f, text="Barney")
   L2.pack()

James

-- 
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/



More information about the Python-list mailing list