473,714 Members | 4,240 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Jul 18 '05 #1
0 1121

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3211
by: Eric Brunel | last post by:
Hi all, I was creating a Tkinter widget in the style of the reversed tabs below Excel worksheets and I stepped in a serious problem: the code I made makes python crash with a seg fault, bus error or X11 BadGC error on both Solaris (2.6 and 2.7) and Linux (Mandrake 8.0); it doesn't crash on Windows. I tried to simplify the script, but I couldn't reproduce the crash with a simpler code. So the code below is somewhat long; sorry for that. ...
4
2298
by: Bgc | last post by:
Hello All, I've been struggling for years now trying to come up with a solution to a very personal programming problem with Python. I'm an educational programmer, and I make applications that are used in educational environments by nontechnical folks. I therefore need GUIs that are pretty, easy to use, and cross platform (win, mac, linux, unix). In my search for a GUI, I've also come to the conclusion that as much as I love Python,...
6
4433
by: Simon Foster | last post by:
Hi all, Has anyone seen the follwoing message on the Windows platform when tring to use Tk? --- >>> import Tkinter >>> root = Tkinter.Tk() Traceback (most recent call last):
3
2514
by: Elaine Jackson | last post by:
When I use a function from tkFileDialog outside of a tk GUI context, it creates a "dummy" tk window. It would be nice to know how to close these windows programmatically. TIA Peace
16
1455
by: Ali | last post by:
I have a the list: info = , , ] I want this info to show on a tk window like this: |--|------------------------| |TK|Blah |
1
2690
by: Christian | last post by:
Hi all, I have an application with a GUI in Tcl/Tk (running on AIX /Linux) and I need to make it running (porting) in Windows 2000. I would like to have some suggestion about this. What IDE should I use to recreate the GUI, is VisualC++ good enough? Or may be the Tcl/Tk could be compatible for Microsoft VisualC++, just some modification for compilation should be enough? The rest of the code of the project is already in C.
1
3255
by: Atul | last post by:
Hi, I have installed a truetype font (.ttf) on a linux machne (SUSE linux 10, KDE) by copying it to my .fonts folder. I can use the font in all applications like open-office and firefox browser. However, I cannot use the font in a python app that I am writing. The list returned by Tkfont.families does not contain this particular font. Any suggestions ?
1
6713
by: rahulnag22 | last post by:
Hi, I have a Tk() window "base_win = Tk()" with multiple frames on it having a combination of widgets. If I click on say a button widget which launches a new top level window "new_win = TopLevel()", I was looking for a way for this "new_win" to always stay on top of "base_win" till I close "new_win", as a result also not allowing any selections to be made in the "base_win" . Thanks Rahul
3
1167
by: luke.hoersten | last post by:
I'm looking for a good example of how to correctly abstract TK code from the rest of my program. I want to just get some user info and then get 4 values from the GUI. Right now I've written it OOP per the examples on python.org but it doesn't seem to be meshing very well with the rest of my project. Can anyone suggest some examples so that I can get more ideas? Thanks, Luke
0
8808
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8712
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9316
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9077
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7954
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5959
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4729
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3160
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2113
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.