[Tkinter-discuss] ttk style dilema

Michael O'Donnell michael.odonnell at uam.es
Mon Apr 27 18:10:28 CEST 2009

Hi Sorin,

I think the following will do what you want (where tk is your main window):

    tk.option_add("*font", "-*-*-*-I-*--*-*-*-*-*-*")

For example:

from Tkinter import *
tk = Tk()
tk.option_add("*font", "-*-*-*-I-*--*-*-*-*-*-*")
Label(tk, text="Hello").pack(side=TOP)
Button(tk, text="Hello").pack(side=TOP)
e1.insert(END, "Hello")

For background, look at:


And on x fonts:



On Mon, Apr 27, 2009 at 5:15 PM, Sorin Schwimmer <sxn02 at yahoo.com> wrote:
> Hi All,
> I installed recently tcl/tk 8.5.6, Python 2.6.2 and pyttk 0.3 on a Linux (Gentoo) machine.
> I would like to be able to change two things in entries:
> - the font should be the default, but in italics
> - selected text in an entry should have white background and gray foreground
> How can I accomplish that? How can I determine what is the actual TkDefaultFont?
> Thanks
> SxN
>      __________________________________________________________________
> Be smarter than spam. See how smart SpamGuard is at giving junk email the boot with the All-new Yahoo! Mail.  Click on Options in Mail and switch to New Mail today or register for free at http://mail.yahoo.ca
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss

More information about the Tkinter-discuss mailing list