我想每秒钟更新一次LCD上显示的值。我是PyQt的新手。
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
[[UI configuration goes Here]]
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
x = datetime.datetime.now()
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.label_5.setText(_translate("MainWindow",x.strftime("%I:%M:%S %p")))
self.lcdNumber_2.display(22222.22222)
self.lcdNumber.display(1255.45258)
# self.Time(MainWindow)
def Time(self, MainWindow):
i = 0
while i<2 :
time.sleep(1)
self.lcdNumber_2.display(3333.3333)
self.lcdNumber.display(9999.9999)
def main():
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
main = Ui_MainWindow()
main.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())
if __name__ == "__main__":
main()
我想要的是每秒钟更改一次该值。 我将从另一个函数中调用这些值。