Tkinter or Python issue?

Fredrik Lundh fredrik at
Wed Oct 19 09:11:12 CEST 2005

Eugene Druker wrote:

> tkFont.Font(...) is a class instance, while you need font description.

Font instances are font descriptors.

    >>> f = tkFont.Font(family="ariel", size=24, weight=tkFont.BOLD)
    >>> f
    <tkFont.Font instance at 0x00A3AC60>
    >>> print f

> t.tag.config( 'TBU', font=('times', 12, 'bold','underline') )
> t.tag_config( 'AB', font=('arial',24,'bold') )

the problem here is a variation of the old garbage collection problem (Tcl
uses names as references, so the fact that Tk uses an object isn't enough to
keep Python's GC away from it).  the solution is to hold on to the objects
in Python.


More information about the Python-list mailing list