QLineEdit单行文本框
import sys
import time
from PyQt6.QtGui import QValidator,QIntValidator
from PyQt6.QtWidgets import QApplication,QLabel,QLineEdit
from PyQt6 import uicif __name__ == '__main__':app=QApplication(sys.argv)ui=uic.loadUi("./QLine单行文本框.ui")mylineEdit:QLineEdit=ui.lineEdit #lineEditmylineEdit2: QLineEdit = ui.lineEdit_2 # lineEdit_2mylineEdit.setValidator(QIntValidator())#设置文本框验证器ui.show()mylineEdit.setText("python222")#设置文本框内容print(mylineEdit.text())#获取文本框内容mylineEdit.clear()#清除文本框内容mylineEdit2.setFocus()#使文本框得到焦点sys.exit(app.exec())