[Tutor] Auto Refresh

Hi haztang17 at gmail.com
Fri Feb 27 19:38:55 CET 2009


I am trying to read a value in a variable from a different class every time
I click on a refresh button for my GUI program. The problem is I am using
statictext so when I refresh, it displays the new value on top of the old
one.

In my main GUI:

def refresh(self, event):
x = refresh_var()
value = wx.StaticText(self, -1, str(x.var_rate))


In my refresh class:

class refresh_var():

     def var_rate(self):
     random_var = random.randint(5, 100)
     return random_var

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? Or is there a better command/syntax that does
the same job? I am ultimately trying to make it so the GUI program refreshes
and rereads random_var on a set interval. Can anyone offer any advice on how
to do it or any commands I can read up on the Internet?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090227/be63b570/attachment.htm>


More information about the Tutor mailing list