Preferences in Tkinter applications -- partial answer

Russell E. Owen owen at astrono.junkwashington.emu
Fri Feb 1 13:09:17 EST 2002


Thanks to reading Welch "Practical Programming in Tcl and Tk" and 
corresponding with Laura Creighton, I have found the following:

Tkinter widgets will live update fonts (by using named fonts) and colors 
(by using tk_setPalett). This was from Welch. Details are available on 
my Tkinter Folklore page 
<http://www.astro.washington.edu/owen/ROTKFolklore.html>.

Other preferences require some sort of callback or signalling mechanism. 
Laura Crieghton had some interesting suggestions including using Patrick 
O'Brien's global signal dispatcher: 
<http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/87056>.
I plan to start with a PrefVar class that includes callbacks. (I could 
simply use Tk variables, and Welch has a nice-looking implementation, 
but callbacks are easy in Python.)


I did come out of this with one question:
- If one creates a named font (a tkFont.Font object), is it possible to 
modify that font's characteristics, starting from just its name? The 
issue is that once you put a tkFont.Font into the option database, you 
can only get the name back out. But I can't see how to modify a named 
font's characteristics with just its name. (Well, it can be done by 
calling explicit tcl code, but it's probably easier to just keep the 
Font objects around.)

-- Russell



More information about the Python-list mailing list