ich habe das Problem, dass ich einen Text mit Umlauten darstellen möchte, dies lässt aber StaticFancyText nicht zu. Ich habe jetzt nach Möglichkeiten gesucht im Hinblick darauf, dass es xml-konform sein muß - aber leider nichts gefunden:-(
Wie kann ich die Umlaute darstellen lassen??
Gruß Mathi
hier zum ausprobieren:
Code: Alles auswählen
# -*- coding: iso-8859-15 -*-
import wx
import wx.lib.fancytext as fa
#wx.SetDefaultPyEncoding("iso-8859-15")
class StaticFancyText(fa.StaticFancyText):
"""StaticFancyText with SetLabel function."""
def SetLabel(self, label):
bmp = fa.RenderToBitmap(label,
wx.Brush(self.GetBackgroundColour(), wx.SOLID))
self.SetBitmap(bmp)
class ErgebnisPanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent,style=wx.TAB_TRAVERSAL | wx.BORDER_RAISED)
# Ausgabe
Ergebnis = StaticFancyText(self, -1, ' Ergebnis: ',pos=(10,10))
self.Ergebnis1 = StaticFancyText(self, -1, 'test1',pos=(40,40))
self.Freeze()
self.Ergebnis1.SetLabel('Tüüüren')
self.Thaw()
self.Layout()
class Test(wx.Frame):
def __init__(self, parent = None,id=-1, title = "testframe", size = wx.Size(200, 200)):
wx.Frame.__init__(self, parent,id, title, size = size)
#MainPanel
main_panel = wx.Panel(self,-1)
vbox = wx.BoxSizer(wx.VERTICAL)
main_panel.SetSizer(vbox)
#Ergebnispanel
self.ergebnis_panel=ErgebnisPanel(main_panel)
vbox.Add(self.ergebnis_panel, 1, wx.EXPAND)
self.Show()
def main():
"""Main"""
app = wx.App()
f = Test()
f.Center()
f.Show()
app.MainLoop()
if __name__ == "__main__":
main()