Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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()
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Window #freezes #clicking #button #python
ADD COMMENT
Topic
Name
8+6 =