Answers for "Window freezes after clicking of button in python GTK3"

0

Window freezes after clicking of button in python GTK3

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()
Posted by: Guest on May-31-2021

Code answers related to "Window freezes after clicking of button in python GTK3"

Python Answers by Framework

Browse Popular Code Answers by Language