WXpython Question

Gandalf goldnery at gmail.com
Fri May 23 09:40:13 EDT 2008


On May 23, 3:29 pm, Mike Driscoll <kyoso... at gmail.com> wrote:
> On May 23, 8:24 am, Gandalf <goldn... at gmail.com> wrote:
>
> > I try to reach a specific wx StaticText element's text and to change
> > it by clicking on a button
>
> > now let's say the this is my element:
>
> > wx.StaticText(panel, 15, "Hello" ,(30, 70) , style=wx.ALIGN_CENTRE)
>
> > And this is my EVT_BUTTON bind function :
>
> > def OnClick(event):
>
> > which code shude i enter to change "hello" to "goodbay"?
>
> > thanks
>
> You're probably looking for SetLabel(). So if you do something like
> this to instantiate the StaticText:
>
> self.myText = wx.StaticText(panel, 15, "Hello" ,(30, 70) ,
> style=wx.ALIGN_CENTRE)
>
> Then you can change your text by adding this to your OnClick event
> handler:
>
> self.myText.SetLabel("goodbye")
>
> Have fun! And remember, there's a great wxPython mailing list too:
>
> http://www.wxpython.org/maillist.php
>
> Mike

Thanks!



More information about the Python-list mailing list