User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Python section within the Software Development category of DaniWeb, a massive community of 402,582 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,318 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Python advertiser: Programming Forums

Help needed for displaying extended charactors in Tk()

Join Date: Jan 2006
Posts: 218
Reputation: katharnakh is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 19
katharnakh's Avatar
katharnakh katharnakh is offline Offline
Posting Whiz in Training

Re: Help needed for displaying extended charactors in Tk()

  #4  
Apr 1st, 2007
Hi,

Originally Posted by dav_yip View Post
I ended up geting " itself ムa parodyメ." as my result and I need the result to be "itself ‘a parody’."


to get the actual characters you need to specify the character encoding. Make sure when use/deal with non-ascii character you specify the encoding type.

So label displaying the text you wanted...
  1. # -*- coding: UTF-8 -*-
  2.  
  3. from Tkinter import *
  4. root = Tk()
  5. Label(root, text = "itself ‘a parody’.").pack()
  6. root.mainloop()

There are many encodings that Python supports. I have used UTF-8(UNICODE Tranformation Format).

To learn/know more about this you can go through the following link.
http://www.amk.ca/python/howto/unicode


kath.
challenge the limits
Reply With Quote  
All times are GMT -4. The time now is 11:13 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC