tkinter buttons and columnspan

Laura Creighton lac at strakt.com
Wed Jan 22 15:08:59 CET 2003


> Yep, that's exactly what I'm saying; it doesn't work:
> 
> from Tkinter import *
> 
> root = Tk()
> 
> Button(root,text = 'foo').grid(column=0, row=0)
> Button(root,text = 'foo').grid(column=1, row=0)
> Button(root,text = 'foo').grid(column=0, row=2, columnspan=2)
> 
> root.mainloop()

You need the sticky option. 
Button(root,text = 'foo').grid(column=0, row=2, columnspan=2, sticky=W+E+N+S)

see: http://www.pythonware.com/library/tkinter/introduction/x4951-patterns.htm

Laura Creighton





More information about the Python-list mailing list