Setting default option values for Tkinter widgets

Eric Brunel eric_brunel at
Thu Mar 3 13:10:52 CET 2005

On 3 Mar 2005 03:02:48 -0800, Harlin Seritt <harlinseritt at> wrote:

> There are certain options for Tkinter widgets that have default values
> that I don't much care for (borderwidth, font come to mind) and
> continuously change when I'm building interfaces. With a bit of
> tweaking I have been able to give the widgets a look that rivals the
> best of them. However, I get tired of doing this when I'm writing code
> and would like a way that I could universally change them on my system.
> I have tried to find where in the class files ( that I can
> change these and haven't been able to find them. Are there certain
> lines in certain files/modules/classes that I can change the values for
> these things like font, border, etc.?

tk allows to write your preffered options to an option file and to load it via the method option_readfile in your application.

For an example on how the options can be set, see:
The file should contain the arguments passed to "option add" commands.

For a reference on what options are available and how to specify them in an option file, see the tk manual pages here:
The name for the widget is usually the name of the corresponding Tkinter class; the name for the option is the second name found in the standard and widget-specific options sections in the man pages (named "Database name" in the section text). So for example, if you want to set the default select color for checkbuttons, you'll put in your option file a line:

*Checkbutton.selectColor: blue

python -c 'print "".join([chr(154 - ord(c)) for c in "U(17zX(%,5.z^5(17l8(%,5.Z*(93-965$l7+-"])'

More information about the Python-list mailing list