top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Determining whether a glyph is available in Tkinter?

+2 votes
437 views

I have a Tkinter app that can optionally label some buttons with certain Unicode glyphs that aren't always available (depending on the OS, etc.).

When they aren't available, Tkinter renders them as "uNNNN". What I'd like to do is check whether the glyphs are available, and fall back to my own alternate text for the button if not. Can I do this?

I'd also like to do the same in pygtk.

posted Dec 16, 2013 by Dewang Chaudhary

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

It depends on the font in use. The best scenario would be to always use the same unicode font. Idle, built on tkinter, has a configuration dialog that gets a list of available fonts and sets the one the user selects. I use Lucida Sans Unicode. It is not very pretty, but it seems to cover much the BMP. AFAIK, it should be available on all Windows from XP on. I do not know what comes with *nix and mac, but from reading

https://en.wikipedia.org/wiki/Unicode_font#List_of_Unicode_fonts

there seem to be TrueType fonts that you could install with your software: FreeSerif (etc), GNU Unifont, (both GPL), BitstreamCyber (free for non-commercial use). The font table linked above is followed by table indicating something about coverage. Unifont is the champ.

answer Dec 16, 2013 by anonymous
Similar Questions
+2 votes

I'm trying out Tkinter with the (non object oriented) code fragment below: It works partially as I expected, but I thought that pressing "1" would cause the program to quit, however I get this message:

TypeError: quit() takes no arguments (1 given),

I tried changing quit to quit() but that makes things even worse. So my question: can anyone here help me
debug this?

#!/usr/bin/env python
import Tkinter as tk
def quit():
 sys.exit()
root = tk.Tk()
label = tk.Label(root, text="Hello, world")
label.pack()
label.bind("", quit)
root.mainloop()
+1 vote

I Tried the below code, the color is not reflected, Am i missing something?

#add description box beside test cases
    testCaseDescWindow = gtk.ScrolledWindow()
    testCaseDescWindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
    testCaseDescWindow.get_vscrollbar().modify_fg(gtk.STATE_NORMAL,gtk.gdk.color_parse('#40515F'))
    testCaseDescWindow.get_hscrollbar().modify_fg(gtk.STATE_NORMAL,gtk.gdk.color_parse('#40515F'))
–1 vote

Give the factor which determine the presence of humidity in air

...