[Tutor] Tkinter questions

jfouhy@paradise.net.nz jfouhy at paradise.net.nz
Tue May 17 01:03:45 CEST 2005


Quoting Alberto Troiano <albertito_g at hotmail.com>:

> How can I change the background color of a label??????
> How can I change the font-size and make it BOLD??????

Check out Fredrik Lundh's _Introduction to Tkinter_:
http://www.pythonware.com/library/tkinter/introduction/

In particular, the section on widget customization/styling:
http://www.pythonware.com/library/tkinter/introduction/widget-styling.htm

If you are using Pmw, you can also use Pmw.logicalfont() to change the font.

(eg: 

tk = Tk()
fixed = Pmw.logicalfont(name='Fixed', weight='bold')
Label(tk, background='blue', font=fixed, text='Hello world!').pack()

)

-- 
John.


More information about the Tutor mailing list