📜  单击python GTK3中的按钮后窗口冻结 - Python代码示例

📅  最后修改于: 2022-03-11 14:46:40.226000             🧑  作者: Mango

代码示例1
import threading

def on_next2_clicked(self,button):
    def my_thread(obj):
        cmd = "My Command"
        proc = subprocess.Popen(cmd,shell=True, stdout=subprocess.PIPE)
        while True:
                line = proc.stdout.read(2)
                if not line:
                    break
                obj.fper = float(line)/100.0
                obj.ui.progressbar1.set_fraction(obj.fper)
        print "Done"

    threading.Thread(target=my_thread, args=(self,)).start()