Tkinter or Python issue?

Russell E. Owen rowen at cesmail.net
Wed Oct 19 16:45:42 EDT 2005


In article <opsyvskfiorqur0o at eb.pragmadev>,
 "Eric Brunel" <eric_brunel at despammed.com> wrote:

>You should now see why it works here: your first tkFont.Font is remembered at 
>Python level in a variable. So it is not discarded once the tag_config is 
>over. So the second tkFont.Font is not allocated at the same location, so it 
>doesn't have the same id, and it doesn't have the same name at tcl level. This 
>is the general solution to the problem: keep your fonts in Python variables, 
>so they won't be discarded and their names will never be re-used.

Yes. I consider this dangerous behavior, by the way and submitted a 
patch (that was not accepted) that would prevent this garbage collection.

tkFont is Tkinter's interface to tk named fonts. If you create a tkFont 
instance for a named font and then let it disappear, the named font 
disappears, even if other tkFont instances exist that map the same named 
font.

-- Russell



More information about the Python-list mailing list