470,855 Members | 1,135 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,855 developers. It's quick & easy.

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(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
0 1039

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Eric Brunel | last post: by
4 posts views Thread by Bgc | last post: by
6 posts views Thread by Simon Foster | last post: by
3 posts views Thread by Elaine Jackson | last post: by
16 posts views Thread by Ali | last post: by
1 post views Thread by Christian | last post: by
3 posts views Thread by luke.hoersten | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.