By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,443 Members | 1,626 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,443 IT Pros & Developers. It's quick & easy.

Tkfont buggy for two Tk() top level windows

P: n/a
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(family="Courier", size=12)

Entry(win_one, font=myfont).pack(fill='both',expand=1)
Entry(win_two, font=myfont).pack(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.



Jul 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.