Let me try to type this on an iPad. >From Tkinter import *
Root = Tk() Sub = Frame(Root) Label(Sub, text = "Now is the time\nto fix this.").pack(side = TOP) SSub = Frame(Sub) Entry(SSub).pack(side = LEFT, expand = YES, fill = X) Entry(SSub).pack(side = LEFT, expand = YES, fill = X) SSub.pack(side = TOP, fill = X) SSub = Frame(Sub) Entry(SSub).pack(side = LEFT, expand = YES, fill = X) Entry(SSub).pack(side = LEFT, expand = YES, fill = X) SSub.pack(side = TOP, fill = X) Sub.pack(side = TOP, fill = X, anchor = N) Sub = Frame(Root) Label(Sub, text = "Other stuff here.").pack() Sub.pack() mainloop() You just didn't have the Sub frame around everything to keep them glued together and at the top. Bob Sent from my iPad. Sucks for writing code. On Sep 19, 2012, at 0:09, Lion Kimbro <lionkim...@gmail.com> wrote: > > Dear tkinter-discuss, > > I'm trying to make a user interface like the following: > > :::::::::::::::::::::::::::::::::::::::::::: > : XXXXXXXXXXXXXX : <- a Label > :[ <-- expands ][ expands --> ]: <- 2 Entries > :[ <-- expands ][ expands --> ]: <- 2 more Entries > : : > : (empty space expands : > : downward) : > :..........................................: > > Pseudo-code (full code at end of document): > > toplevel > "XXXXXXXXXXXXXX" label anchor=n pack > frame expand=1 fill=x anchor=n pack > entry expand=1 fill=x anchor=n lpack > entry expand=1 fill=x anchor=n lpack > > frame expand=1 fill=x anchor=n pack > entry expand=1 fill=x anchor=n lpack > entry expand=1 fill=x anchor=n lpack > > frame expand=1 fill=both anchor=n pack > > > What I'm finding is this: > > 1. the label (XXXXXXXXXXXXXX) hugs the top of the window > (GOOD) > > 2. the top two entries hug the label > (GOOD) > > 3. the lower two entries space a ways away from the top two entries > (DO NOT WANT) > > What I want instead, is that the lower two entries hug the top two > entries. > > (More deeply: I want to UNDERSTAND why this is happening like this. > I could use a grid and that would solve this problem, but I want to > have facility with the packer, too.) > > I've tried changing around the values a bunch, but I just don't have > any luck getting this to work. > > My assumption (that seems to be flawed) is that when I set expand=1, > that if it says "fill=x", then that means that it will ONLY expand > horizontally. But it seems to be expanding in both directions. > > Thoughts? Insights? > > > == Full Example (Python 3.2) == > > from tkinter import * > > t = Toplevel() > > lbl = Label(t, text="XXXXXXXXXXX") > lbl.pack(side=TOP, anchor=N) > > f1 = Frame(t) > f1.pack(side=TOP, expand=1, fill=X, anchor=N) > > e11 = Entry(f1) > e11.pack(side=LEFT, expand=1, fill=X, anchor=N) > e12 = Entry(f1) > e12.pack(side=LEFT, expand=1, fill=X, anchor=N) > > f2 = Frame(t) > f2.pack(side=TOP, expand=1, fill=X, anchor=N) > > e21 = Entry(f2) > e21.pack(side=LEFT, expand=1, fill=X, anchor=N) > e22 = Entry(f2) > e22.pack(side=LEFT, expand=1, fill=X, anchor=N) > > # This last one seems to do nothing. > # My hope was that it would somehow "pressure" f2 higher, but nope. > > f3 = Frame(t) > f3.pack(side=TOP, expand=1, fill=X, anchor=N) > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss@python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss