Bootstrap

PYQT5笔记 设置LineEdit 回显

EchoMode 回显模式

1.Normal
2.NoEcho
3.Password
4.PasswordEchoOnEdit

from PyQt5.QtWidgets import *
import sys


class QLineEditEchoMode(QWidget):
    def __init__(self):
        super(QLineEditEchoMode, self).__init__()
        self.initUI()
        
    def initUI(self):
        self.setWindowTitle('LineEdit回显模式')

        formLayout = QFormLayout()	# 布局

        normalLineEdit = QLineEdit()
        noEchoLineEdit = QLineEdit()
        pwdLineEdit = QLineEdit()
        pwdEchoOnLineEdit = QLineEdit()
		# 布局设置
        formLayout.addRow('Normal',normalLineEdit)
        formLayout.addRow('NoEcho',noEchoLineEdit)
        formLayout.addRow('Password',pwdLineEdit)
        formLayout.addRow('PasswordEchoOnEdit',pwdEchoOnLineEdit)
		# 设置LineEdit未输入时的显示信息
        normalLineEdit.setPlaceholderText("Normal")
        noEchoLineEdit.setPlaceholderText("NoEcho")
        pwdLineEdit.setPlaceholderText("Pwd")
        pwdEchoOnLineEdit.setPlaceholderText("PwdEcho")
		# 设置回显
        normalLineEdit.setEchoMode(QLineEdit.Normal)
        noEchoLineEdit.setEchoMode(QLineEdit.NoEcho)
        pwdLineEdit.setEchoMode(QLineEdit.Password)
        pwdEchoOnLineEdit.setEchoMode(QLineEdit.PasswordEchoOnEdit)

        self.setLayout(formLayout)

if __name__ == '__main__':
    app = QApplication(sys.argv)
    main = QLineEditEchoMode()
    main.show()
    sys.exit(app.exec_())

悦读

道可道,非常道;名可名,非常名。 无名,天地之始,有名,万物之母。 故常无欲,以观其妙,常有欲,以观其徼。 此两者,同出而异名,同谓之玄,玄之又玄,众妙之门。

;