내 pyGTK 응용 프로그램을 스레딩하는 데 문제가 있습니다. 스레드에게 작업을 완료 할 시간을줍니다. 문제가 발생하면 계속 진행하지만 사용자에게 경고합니다. 그러나 일단 계속되면,이 스레드는 gtk.main_quit가 호출 될 때까지 멈춘다. 이것은 나를 혼란스럽게합니다.pygtk 응용 프로그램의 개별 스레드
관련 코드 :
class MTP_Connection(threading.Thread):
def __init__(self, HOME_DIR, username):
self.filename = HOME_DIR + "mtp-dump_" + username
threading.Thread.__init__(self)
def run(self):
#test run
for i in range(1, 10):
time.sleep(1)
print i
..........................
첫째start_time = time.time()
conn = MTP_Connection(self.HOME_DIR, self.username)
conn.start()
progress_bar = ProgressBar(self.tree.get_widget("progressbar"),
update_speed=100, pulse_mode=True)
while conn.isAlive():
while gtk.events_pending():
gtk.main_iteration()
if time.time() - start_time > 5:
self.write_info("problems closing connection.")
break
#after this the program continues normally, but my conn thread stops
나는 당신의 고통을 느낍니다. 나는 나 자신의 앞에 pygtk를 가진 실을 꿰는 게임을 통해이었다! –