[Tutor] width

bhaaluu bhaaluu at gmail.com
Thu Nov 15 23:19:26 CET 2007


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,fill=Y)
Button(root, text='Blue', bg="blue", fg="white",
command=root.quit).pack(expand=YES,fill=BOTH)
root.mainloop()


On Nov 15, 2007 4:40 PM, linda.s <samrobertsmith at gmail.com> 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", 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()
>
> mainloop()
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>



-- 
b h a a l u u at g m a i l dot c o m
http://www.geocities.com/ek.bhaaluu/index.html


More information about the Tutor mailing list