from PyQt5.QtWidgets import *
import sys
class QLineEditForm(QWidget):
def __init__(self):
super(QLineEditForm,self).__init__()
self.initUI()
def initUI(self):
self.setWindowTitle('文本输入框的回显模式')
formlayout = QFormLayout()
normal = QLineEdit()
noEchol = QLineEdit()
password = QLineEdit()
passwordEcho =QLineEdit()
formlayout.addRow("Normal", normal)
formlayout.addRow("NoEcho", noEchol)
formlayout.addRow("Password", password)
formlayout.addRow("PasswordEcho", passwordEcho)
normal.setPlaceholderText("Normal")
noEchol.setPlaceholderText("NoEcho")
password.setPlaceholderText('Password')
passwordEcho.setPlaceholderText('Passwordecho')
normal.setEchoMode(QLineEdit.Normal)
noEchol.setEchoMode(QLineEdit.NoEcho)
password.setEchoMode(QLineEdit.Password)
passwordEcho.setEchoMode(QLineEdit.PasswordEchoOnEdit)
self.resize(300,200)
self.setLayout(formlayout)
if __name__ == '__main__':
app= QApplication(sys.argv)
main= QLineEditForm()
main.show()
app.exit(app.exec_())
