Tkfont buggy for two Tk() top level windows

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jack Diederich

    Tkfont buggy for two Tk() top level windows

    I'm calling Tk() twice to create two top level windows,
    which works fine in every respect except fonts.
    Assigning a Tkfont to widgets in the first Tk() window I create works
    fine, the font looks good as it should. But if I start a another
    window by calling Tk() again the second window will always use some
    awful default font. Swapping the two lines that call Tk() will
    change which one actually uses the font and which doesn't.

    The code looks like:
    win_one = Tk()
    win_two = Tk()
    myfont = tkFont.Font(fam ily="Courier", size=12)

    Entry(win_one, font=myfont).pa ck(fill='both', expand=1)
    Entry(win_two, font=myfont).pa ck(fill='both', expand=1)

    Any text on the first window obeys the font, the second
    one will always use some system default. switching the two lines
    that call Tk() reverses which window goes font happy.

    If calling Tk() twice has undefined behavior I would rather it
    raise a useful exception instead of continuing partially gimpy.

    Debian testing, python 2.3.3, tk 8.2.3-5
    This has been the behavior for 6-12 months (as long as I've been using
    Tk). Until now I just assumed I had missed a call, after checking it
    out it seems to be a Tk thing.

    TIA,

    -jackdied



Working...