Change Label of 3 StaticTxt Items

You have to create three instances of a wx.StaticText.
Try this:

class CanvasFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None,-1,
                         'CanvasFrame',size=(250,250))
        self.SetBackgroundColour(wx.WHITE)
        #three instances of a wx.StaticText
        alltxt = []
        posx = 0
        for item in range(3):
            tmptxt=wx.StaticText(parent = self,
                       id = -1,
                       label = "TEST",
                       pos = wx.Point(posx, 0),
                       size = wx.Size(50, 50),
                       style = 0,
                       name = "staticText")
            posx = posx + 50
            alltxt.append(tmptxt)
        #change the the labels
        s = ['please', 'help', 'me']
        for k in xrange(3):
            alltxt[k].SetLabel(s[k])

Your dear reader,
Jean-Michel Fauth, Switzerland

Thanks a lot this helped

matthias janes

Jean-Michel Fauth wrote:

···

You have to create three instances of a wx.StaticText.
Try this:

class CanvasFrame(wx.Frame):
   def __init__(self):
       wx.Frame.__init__(self, None,-1,
                        'CanvasFrame',size=(250,250))
       self.SetBackgroundColour(wx.WHITE)
       #three instances of a wx.StaticText
       alltxt =
       posx = 0
       for item in range(3):
           tmptxt=wx.StaticText(parent = self,
                      id = -1,
                      label = "TEST",
                      pos = wx.Point(posx, 0),
                      size = wx.Size(50, 50),
                      style = 0,
                      name = "staticText")
           posx = posx + 50
           alltxt.append(tmptxt)
       #change the the labels
       s = ['please', 'help', 'me']
       for k in xrange(3):
           alltxt[k].SetLabel(s[k])

Your dear reader,
Jean-Michel Fauth, Switzerland

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org