Greek Letters In A Gui - Python
I don't know how to write Greek letters in a GUI. I am working on a Physics program and I need to show units on the GUI. Do I have to download any extra libraries? Is there a modu
Solution 1:
Unicode includes definitions for both the Greek alphabet and several mathematical symbols. If you are using any form of Unicode in your environment, it should be simple:
>>>from Tkinter import *>>>root = Tk()>>>w = Label(root, text=u"Hello, \u03bc-world!")>>>w.pack()>>>root.mainloop()
This will print "Hello, μ-world!" in a Tkinter window.
Solution 2:
IDLE uses Tkinter, Greek letters seem to work fine in there for me
Python 2.6.5 (r265:79063, Apr 162010, 13:09:56)
[GCC 4.4.3] on linux2
Type "copyright", "credits"or"license()"for more information.
****************************************************************
Personal firewall software may warn about the connection IDLE
makes to its subprocess using this computer's internal loopbackinterface. This connection isnot visible on any external
interfaceand no data is sent toor received from the Internet.
****************************************************************
IDLE 2.6.5
>>> print "Ω ω"
Ω ω
>>>
If you wish to use unicode literally in your source, you should include a line like this
# -*- coding: utf-8 -*-
At the top of each file
Solution 3:
>>>print( u'\u03a9' )
Ω
Works for me.
What specific problem are you having?
Post a Comment for "Greek Letters In A Gui - Python"