In pack() add:
expand=YES, fill=X,
expand=YES, fill=Y
or
expand=YES, fill=BOTH
Example:
from Tkinter import *
root = Tk()
Button(root, text='Red', bg="red", fg="white",
command=root.quit).pack(expand=YES,fill=X)
Button(root, text='Green', bg="green", fg="white",
command=root.quit).pack(expand=YES
As to the WHY it works like it does?
http://effbot.org/tkinterbook/pack.htm
On Nov 15, 2007 4:40 PM, linda.s <[EMAIL PROTECTED]> wrote:
> I wonder why the widths are different for the three labels?
> Thanks,
> Linda
>
> from Tkinter import *
>
> root = Tk()
>
> w = Label(root, text="Red", bg="red
I wonder why the widths are different for the three labels?
Thanks,
Linda
from Tkinter import *
root = Tk()
w = Label(root, text="Red", bg="red", fg="white")
w.pack()
w = Label(root, text="Green", bg="green", fg="white")
w.pack()
w = Label(root, text="Blue", bg="blue", fg="white")
w.pack()
main