Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Python
anonymous function?
 

Index | Next | Previous | View Flat


flupke at nonexistingdomain

Aug 18, 2004, 4:40 AM


Views: 300
Permalink
anonymous function?

Hi,

i'm not sure what the exact type of function is called
for what i'm trying to do but here goes:

------ code -----
def OnClick(self, event):
...
elif ( id == ID_BUTTON_CHECK ):
if __debug__: print " Check pushed"
minutes = self.check_time.GetValue()
t = None
if ( self.check.GetLabel() == "check" ):
if ( minutes != "" ):
self.handleCommand("Check %s minutes\n" % str(minutes))
def sendCheckCommand():
self.connection.message("CHECK")
t = threading.Timer(10.0, sendCheckCommand() )
t.start() printed
self.updateGUI("CHECK_WITH_TIME")
------ code -----

The relevant code being the sendCheckCommand() function declared in the
OnClick function. This code starts a timer that should execute
self.connection.message("CHECK") every 30 seconds. I think this is an
anonymous (in Java it is) function and is really not meant to be a
"real" class function. But when i execute the code, it works 1 time but
the second time it doesn't work anymore and i get this error:

Exception in thread Thread-2:
Traceback (most recent call last):
File "C:\Python23\lib\threading.py", line 436, in __bootstrap
self.run()
File "C:\Python23\lib\threading.py", line 544, in run
self.function(*self.args, **self.kwargs)
TypeError: 'NoneType' object is not callable

How can i accomplish this?

Thanks
Benedict
--
http://mail.python.org/mailman/listinfo/python-list

Subject User Time
anonymous function? flupke at nonexistingdomain Aug 18, 2004, 4:40 AM
    Re: anonymous function? richie at entrian Aug 18, 2004, 5:08 AM
    Re: anonymous function? b.niemann at betternet Aug 18, 2004, 5:18 AM
    Re: anonymous function? flupke at nonexistingdomain Aug 19, 2004, 2:53 AM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.