【发布时间】:2018-11-04 07:45:45
【问题描述】:
我有一个按钮,当它被单击时,它会启动一个 GObject 线程,该线程每 2 秒调用一次函数。我想要另一个暂停或停止调用此函数的按钮。谁能引导我走向正确的方向?
使用 Python GTK 3
def on_refreshbutton_clicked(self,widget):
print("Data..")
self.th = GObject.timeout_add(2000,self.refresh_screen)
def on_pausebutton_clicked(self,widget):
print("Paused..")
【问题讨论】:
-
找到了我的答案。我必须使用 GObject.source_remove(self.th)
标签: python-3.x pygtk gtk3 pygobject gobject