Tkinter and utf-8

Justin Ezequiel jezequiel at gmail.com
Fri Oct 29 05:09:34 CEST 2004


What font is Tkinter using for displaying utf-8 characters?

On my Windows XP, most of the characters with names (unicodedata.name)
are displayed WYSIWYG.
However, on my Mandrake (warning: Linux newbie), most characters are
displayed as \u???? where ???? is the Hex code.

## start of script Tkinter_gui.py----------
import Tkinter
import ScrolledText
import codecs
import tkFont

##FONT = 'Courier'

class MyFrame(Tkinter.Frame):
  def __init__(self, master=None):
      self.root = master
      Tkinter.Frame.__init__(self, master)
      self.pack(fill=Tkinter.BOTH, expand=1)
##        self.textBox = ScrolledText.ScrolledText(self, font=(FONT, 12))
      self.textBox = ScrolledText.ScrolledText(self,
font=tkFont.Font(size=12))
      self.textBox.pack(fill=Tkinter.BOTH, expand=1)

  def write(self, txt):
      self.textBox.insert(Tkinter.END, txt)
      self.textBox.see(Tkinter.END)
      self.textBox.update_idletasks()

if __name__ == '__main__':
  root = Tkinter.Tk()

  frame = MyFrame(root)

  f = codecs.open('named.txt', 'r', 'utf-8')
  frame.write('\n'.join(f.read().splitlines()))
  f.close()

  root.minsize(640, 480)
  Tkinter.mainloop()
## end of script ----------

Python 2.3.3 (#2, Feb 17 2004, 11:45:40)
[GCC 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)] on linux2

and

Python 2.2.2 (#37, Oct 14 2002, 17:02:34) [MSC 32 bit (Intel)] on win32
MS Windows XP SP2

Please CC me directly as I am not subscribed

BTW, tried to e-mail directly (with 2 jpeg screenshots and the named.txt file) 
but got the following:

This is an automatically generated Delivery Status Notification

Delivery to the following recipient failed permanently:

    python-list at python.org

Technical details of failure:
PERM_FAILURE: SMTP Error (state 13): 553 rejected, message looks like spam.





More information about the Python-list mailing list