By using PyQt5 I made a window with a simple label, I want to read data by pyserial and replace the label text when the python program start without clicking on any button. could you please let me know how can I do that?
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(666, 577)
Form.setLayoutDirection(QtCore.Qt.LeftToRight)
Form.setStyleSheet("background-color: rgb(0, 0, 0);\n"
"color: #FFF;")
self.formLayout = QtWidgets.QFormLayout(Form)
self.formLayout.setObjectName("formLayout")
self.gridLayout = QtWidgets.QGridLayout()
self.gridLayout.setObjectName("gridLayout")
self.Title = QtWidgets.QLabel(Form)
font = QtGui.QFont()
font.setPointSize(60)
self.Title.setFont(font)
self.Title.setAlignment(QtCore.Qt.AlignHCenter|QtCore.Qt.AlignTop)
self.Title.setObjectName("Title")
self.gridLayout.addWidget(self.Title, 3, 1, 1, 1)
self.formLayout.setLayout(1, QtWidgets.QFormLayout.FieldRole, self.gridLayout)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
self.Title.setText(_translate("Form", "text"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
Form = QtWidgets.QWidget()
ui = Ui_Form()
ui.setupUi(Form)
Form.show()
sys.exit(app.exec_())