Unten mal der Code, ich habe gleich 2 Varianten zusammen gefügt, einmal Änderung direkt in
class ErgebnisPanel(wx.Panel)
und einmal in
class Test(wx.Frame)
ntrunk hat geschrieben:(1) sollte das nicht ins wx-Unterforum?
äääh, ja natürlich wäre es dort besser aufgehoben, sorry.
Code: Alles auswählen
# -*- coding: iso-8859-15 -*-
import wx
import wx.lib.fancytext as fa
#wx.SetDefaultPyEncoding("iso-8859-15")
class ErgebnisPanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent,style=wx.TAB_TRAVERSAL | wx.BORDER_RAISED)
# Ausgabe
Ergebnis = wx.StaticText(self, -1, ' Ergebnis: ',pos=(10,10))
self.Ergebnis1 = fa.StaticFancyText(self, -1, 'test1',pos=(40,40))
self.Freeze()
self.Ergebnis1.SetLabel('anderer Text')
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()
self.Freeze()
self.ergebnis_panel.Ergebnis1.SetLabel('nochmal anderer Text')
self.Thaw()
self.Layout()
def main():
"""Main"""
app = wx.App()
f = Test()
f.Center()
f.Show()
app.MainLoop()
if __name__ == "__main__":
main()