0
我有事件循環的問題。要了解,我想在一些循環中更新標籤/文本瀏覽器/ lineEdit 文本,而沒有按下停止按鈕。Python與Qt,事件循環工作
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.ui.btnStart.clicked.connect(self.btnStart_Clicked)
self.ui.btnStop.clicked.connect(self.btnStop_Clicked)
self.startTime = dt.datetime(2013, 1, 1, 0, 0, 0)
self.nowTime = dt.datetime(2013, 1, 1, 0, 0, 0)
self.ui.lineStart.setText(self.startTime.strftime("%Y-%m-%d %H:%M"))
self.ui.lineNow.setText(self.nowTime.strftime("%Y-%m-%d %H:%M"))
self.ui.textBrowser.setText(self.nowTime.strftime("%Y-%m-%d %H:%M"))
def btnStart_Clicked(self):
print(12)
while (not self.btnStop_Clicked()):
print(23)
self.nowTime += dt.timedelta(minutes = 25)
self.ui.textBrowser.setText(self.nowTime.strftime("%Y-%m-%d %H:%M"))
time.sleep(2)
檢查錯誤日誌 – Valeriy
什麼是你所面臨的問題? – lpapp