Tkinter pack method question

Jp Calderone exarkun at
Fri Feb 14 18:44:18 CET 2003

On Fri, Feb 14, 2003 at 10:15:05AM -0600, sik0fewl wrote:
> Manuel Lanctot wrote:
> >Jonas Geiregat wrote:
> >
> >
> >>using Tkinter when using the pack method how can you set side to LEFT and
> >>TOP ? like
> >>instance.pack(side=TOP and side=LEFT)
> >>how do you code this right
> >
> >
> >If I remember correctly, pack() uses N, SW, E, etc. to "anchor" widgets. 
> >So you could use to get TOP and LEFT:
> >instance.pack(anchor=NW)
> Actually, N,S,E,W are used for the grid method.
> OP, try instance.pack (side=TOP&LEFT) or instance.pack(side=TOP, 
> side=LEFT). I'm not sure how these will work out though...

  Specifying a keyword argument more than once is a SyntaxError.  Your first
example was very close to the mark - TOP and LEFT are actually strings,
though, so you need to concatenate them, not apply bitwise and ;)

  For those on a system with man pages, I recommend all the Tk man pages. 
They use Tcl syntax, but are still vastly useful.  See "man n pack", for


 up 5 days, 22:29, 4 users, load average: 0.24, 0.07, 0.02
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <>

More information about the Python-list mailing list