1import threading
2
3def on_next2_clicked(self,button):
4 def my_thread(obj):
5 cmd = "My Command"
6 proc = subprocess.Popen(cmd,shell=True, stdout=subprocess.PIPE)
7 while True:
8 line = proc.stdout.read(2)
9 if not line:
10 break
11 obj.fper = float(line)/100.0
12 obj.ui.progressbar1.set_fraction(obj.fper)
13 print "Done"
14
15 threading.Thread(target=my_thread, args=(self,)).start()