每次按下我添加到工具栏的按钮时,我都会尝试创建标签。为此,我在Pyqt中创建一个窗口,并调用NewTab类,它具有我想在QTabWidget中添加的QWidget。
这是我的代码:
import threading
import time
def thread(args1, stop_event):
print "starting thread"
stop_event.wait(10)
if not stop_event.is_set():
raise Exception("signal!")
pass
try:
t_stop = threading.Event()
t = threading.Thread(target=thread, args=(1, t_stop))
t.start()
time.sleep(11)
#normally this should not be executed
print "stopping thread!"
t_stop.set()
except Exception as e:
print "action took to long, bye!"
我不知道会发生什么。这是行不通的。我究竟做错了什么?希望你能帮帮我