Dear wxPythonians,
Zunbeltz wrote:
> I need to display a greek letter (big theta) in same label in my
> application. Is it possible? (I'm using wxDesinger)The following works on my system: Microsoft Windows 2000, Active Python
2.3.2, wxPython 2.5.1. It depends on Unicode support at the system level,
though, and that may is not be fully available in all operating systems.
I've changed to unicode support in wxPython and now i can use it.
Thanks for your help
Zunbeltz
···
On Thu, 24 Jun 2004, David J Birnbaum wrote:
Best,
David
djbpitt+python@pitt.edu
________#!/usr/bin/env python
# Ref: Python Cookbook, section 3.18, pp. 96-97
import wx
class MyFrame(wx.Frame):
def __init__(self, *args, **kwds):
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.panel_1 = wx.Panel(self, -1)
self.label_1 = wx.StaticText(self.panel_1, -1, \
"Label with theta: " + u'\N{GREEK CAPITAL LETTER THETA}')
self.button_1 = wx.Button(self.panel_1, -1, \
"Button with theta: " + u'\N{GREEK CAPITAL LETTER THETA}')self.__set_properties()
self.__do_layout()def __set_properties(self):
self.SetTitle("Title with Theta " + u'\N{GREEK CAPITAL LETTER
THETA}')def __do_layout(self):
sizer_1 = wx.BoxSizer(wx.HORIZONTAL)
sizer_2 = wx.BoxSizer(wx.VERTICAL)
sizer_2.Add(self.label_1, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
sizer_2.Add((20, 20), 0, 0, 0)
sizer_2.Add(self.button_1, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
self.panel_1.SetAutoLayout(1)
self.panel_1.SetSizer(sizer_2)
sizer_2.Fit(self.panel_1)
sizer_2.SetSizeHints(self.panel_1)
sizer_1.Add(self.panel_1, 1, wx.EXPAND, 0)
self.SetAutoLayout(1)
self.SetSizer(sizer_1)
sizer_1.Fit(self)
sizer_1.SetSizeHints(self)
self.Layout()# end of class MyFrame
class MyApp(wx.App):
def OnInit(self):
wx.InitAllImageHandlers()
frame_1 = MyFrame(None, -1, "")
self.SetTopWindow(frame_1)
frame_1.Show(1)
return 1# end of class MyApp
if __name__ == "__main__":
app = MyApp(0)
app.MainLoop()---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
--
Zunbeltz Izaola Azkona (zunbeltz at wm dot lc dot ehu dot es)
Materia Kondentsatuaren Fisika Saila |
Zientzia eta Teknologia Fakultatea | Telf: 34 946015326
Euskal Herriko Unibertsitatea |
PK 644 | Fax: 34 944648500
48080 Bilbo (SPAIN) |
--