[Tutor] Auto Refresh

Alan Gauld alan.gauld at btinternet.com
Sat Feb 28 02:00:21 CET 2009


"Hi" <haztang17 at gmail.com> wrote


> In my main GUI:
>
> def refresh(self, event):
> x = refresh_var()
> value = wx.StaticText(self, -1, str(x.var_rate))

Its not clear how you are positioning Static Text, I suspect you
need it as a opart of your main GUI and then reference it in
here and use the SetLabel() method to update its contents.

But I also not that you are not calling the var_rate method of x.
Or does your code really look like

value = wx.StaticText(self, -1, str(x.var_rate()))

Notice the extra parens...

> So each time I click on the button, which runs refresh, the new 
> value
> generated by random.randint will be on top of the old number. Is 
> there any
> commands I can use to remove the old value that is on the GUI window 
> before
> I put the new one on there?

I think you can just update the content of the original Text widget
using SetLabel()


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/ 




More information about the Tutor mailing list