0
我正在開發使用快速套牢線程PyGTK的多線程應用程序。所以我有各種各樣的可能性的實驗,結果發現,我的工作線程,只有當我在GUI做一些 這裏是我的代碼主題僅適用於GUI事件的PyGTK
t = threading.Thread(target=self.calc,args=(treeiter))
t.daemon = True
t.start()
def calc(self,treeiter):
store=self.builder.get_object('liststore1')
per=0
while 1:
print "Calcing and changing percent,per="+str(per)
store.set_value(treeiter,4,str(int(per))+"%")
per+=1
time.sleep(1)
我試圖更新由線程在liststore
值,但它只能得到更新當我點擊一些按鈕或其他GUI事件爲什麼是這樣?爲什麼線程不在後臺運行?
我使用的快速和它 '從gi.repository進口Gtk' 沒有gtk.gdk –
開發讓你在使用GTK + 3?在這種情況下,我認爲你應該使用'Gtk'前綴,所以'Gtk.threads_enter()'等等' –
AttributeError的:「gi.repository.Gtk」對象有沒有屬性「似乎threads_enter'' –