setting the font in Tkinter

Paul Magwene paul.magwene at
Sat Sep 16 23:04:55 CEST 2000

Matthew Dixon Cowles wrote:
> On Sat, 16 Sep 2000 01:47:11 GMT, Rick Pasotto <rickp at>
> wrote:
> >How do I set the default font for a window and all its widgets? The
> >system default is too small.
> If there's a way, I don't know what it is. And more to the point, it
> seems that Fredrik Lundh doesn't know one either since such a thing
> isn't mentioned in his excellent Introduction to Tkinter, at
> It seems that it's necessary to set widgets' fonts individually.
> Regards,
> Matt

You can set application wide defaults very easily in Tkinter.  The
following is from John Grayson's excellent book, Python and Tkinter
programming (you NEED this book if you want to do any really portable
Python GUI work):

-- Create a file called optionDB (or any other name you'd like) in the
same directory as your source code.  This file is a simple text file
specifying defaults (like the .Xdefaults file on X windows). E.g. (taken
directly from Grayson):

*font:		Verdana 10
*Label*font:	Verdana 10 bold
*background:	Gray80
*Entry*background: white

This will set the application wide default to Verdana, 10 pt, except for
lables which will use a bold version of the font.  The other options
should be self explanatory.

Then in your sourcecode do something like:

root = Tk()


More information about the Python-list mailing list