First try at Tkinter stuff
Timothy Grant
tjg at avalongroup.net
Fri Jan 7 01:03:09 EST 2000
Hi,
I'm just starting to play with TK and am completely confused with
packing and gridding, etc.
I've got a window that displays four frames. It does it quite nicely and
they look very nice. However, when I add a label or a button, the frame
to which I add the label or button shrinks to the size of the button.
This is completely undesirable behaviour. I have tried using both .pack
and .grid, but I guess I don't understand how they are supposed to work.
Attached is my little test class.
class Brokerage:
def __init__(self, master):
MainFrame = Frame(master, height=600, width=800)
MainFrame.pack()
SupplierFrame = Frame(MainFrame, height=575, width=300,
relief=GROOVE, borderwidth=1)
SupplierFrame.grid(row=0, column=0, rowspan=2)
DataFrame = Frame(MainFrame, height=250, width=200,
relief=GROOVE, borderwidth=1)
DataFrame.grid(row=0, column=1)
ShippingFrame = Frame(MainFrame, height=250, width=200,
relief=GROOVE, borderwidth=1)
ShippingFrame.grid(row=1, column=1)
VendorFrame = Frame(MainFrame, height=575, width=300,
relief=GROOVE, borderwidth=1)
VendorFrame.grid(row=0, column=2, rowspan=2)
# Code up to here works as expected, code below does not.
Label(SupplierFrame, text="Vendor ID:").pack(side=TOP)
self.hi_there = Button(VendorFrame, text="Hello",
command=self.say_hi)
self.hi_there.pack(fill=BOTH, expand=1)
def say_hi(self):
print "hi there, everyone!"
Thanks for any assistance you might be able to provide.
--
Stand Fast,
tjg.
Chief Technology Officer tjg at exceptionalminds.com
Red Hat Certified Engineer www.exceptionalminds.com
Avalon Technology Group, Inc. (503) 246-3630
>>>>>>>>>>>>EXCEPTIONAL MINDS, INNOVATIVE PRODUCTS<<<<<<<<<<<<
More information about the Python-list
mailing list