Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/322.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 被称为gobject finished state_Python_Multithreading_Gtk_Gobject - Fatal编程技术网

Python 被称为gobject finished state

Python 被称为gobject finished state,python,multithreading,gtk,gobject,Python,Multithreading,Gtk,Gobject,在python脚本中,我执行一个gobject调用。我需要知道,什么时候结束。是否有任何可能的方法来检查这一点? 是否有功能等需要检查 我的代码是: gobject.idle_add(main.process) class main: def process(): <-- needs some time to finish --> next.call.if.finished() gobject.idle\u添加(main.process) 班长: de

在python脚本中,我执行一个gobject调用。我需要知道,什么时候结束。是否有任何可能的方法来检查这一点? 是否有功能等需要检查

我的代码是:

gobject.idle_add(main.process)

class main:
    def process():
         <-- needs some time to finish -->

next.call.if.finished()
gobject.idle\u添加(main.process)
班长:
def进程():
next.call.if.finished()
我想启动另一个对象,等待第一个完成。 我查阅了gobject参考资料,但没有找到必要的东西。
谢谢

我很确定您可以执行类似的操作,但在您的情况下,据我所知更简单,您不需要process()的结果,您只需要使用

main.event.wait() // next.call.if.finished()

我已经在该链接中使用了非常相同的方法,包括结果的必要性,这是一个加号。

另一种方法是使用要处理的对象列表启动空闲函数,因此,您可以让空闲函数自己重新运行,而不是等待一个对象完成,然后再启动另一个对象:

def process():
    # process object
    if any_objects_left:
        # set up the next object
        return True
    return False  # remove the idle callback