[Tkinter-discuss] Grid

Cam cam at bitflipper.ca
Thu Jan 4 04:26:30 CET 2007


Any grid experts about? This minimal Tkinter program:

     from Tkinter import *
     root = Tk()
     root.geometry('640x480')
     B = Button(root)
     B.grid(column=0,row=0,sticky='wn')
     root.mainloop()

produces a top-level with a Button centered in it. But I don't want the
button in the middle, I want it in the upper left where you would sort
of expect (0,0) to be. I thought the sticky option might do that but
it doesn't.

If it was just one button I'd use pack. But it's a bunch of buttons and
they really need to be arranged in an array so I'm pretty much stuck
with the grid manager.

Anybody know what I'm doing wrong?

Thanks

Cam Farnell




More information about the Tkinter-discuss mailing list