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