当我尝试使用pyGtk中的超时调用函数时,我收到错误消息TypeError: second argument not callable.我想做的就是在超时内调用一个非常简单的函数.为了说明我的问题,我只是准备了函数do_nothing来说明我的问题.
def do_nothing(self):
return True
# Do interval checks of the timer
def timed_check(self, widget):
self.check_timing = gobject.timeout_add(500, self.do_nothing())
Run Code Online (Sandbox Code Playgroud)
这不起作用......
我究竟做错了什么?
你正在调用这个函数:
self.do_nothing()
Run Code Online (Sandbox Code Playgroud)
你想传递这个功能:
self.do_nothing
Run Code Online (Sandbox Code Playgroud)
省略括号.
| 归档时间: |
|
| 查看次数: |
606 次 |
| 最近记录: |