setting the font in Tkinter

Rick Pasotto rickp at telocity.com
Sun Sep 17 08:46:30 EDT 2000


On Sat, 16 Sep 2000 17:04:55 -0400 in comp.lang.python, Paul Magwene wrote:
> 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):

I usually try to get all my tech books from Bookpool.com and they don't
list it yet.  Guess I'll have to use someone else.

> -- 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()
> root.option_readfile('optionDB')

Thanks. That works wonderfully.

-- 
"Freedom is just chaos with better lighting."
		-- Alan Dean Foster
		   Rick Pasotto email: rickp at telocity.com



More information about the Python-list mailing list