Question about basic use of a timer object from timeit module to execute code every so often in a class
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Question about basic use of a timer object from timeit module to execute code every so often in a class

From: <42zeros@gmail.com>
Date: Fri Jul 15 2005 - 13:27:45 CEST

I would like a function to be executed every x often.
I was just wondering how to pass the following code correctly. my
object t just doesn't know what checkMail is. How can I tell it that
checkMail is a member of the class MyApp?

thanks in advance,
code is below

class MyApp(wx.App):
    def OnInit(self):

        frame = wxMainFrame(None, "thing")
        icon = wx.Icon('foo.bmp', wx.BITMAP_TYPE_ICO)
        frame.SetIcon(icon)
        self.SetTopWindow(frame)

        t = timeit.Timer("checkMail()","30.0")

        t.timeit()
        return True

    def checkMail():
        
        print "The number of messages is"
Received on Thu Sep 29 16:57:53 2005