QLineEdit控件与4种回显模式(2019/09/05)

“”"
QLineEdit控件与4种回显模式
基本功能: 输入单行文本
4种模式:
1)nomal
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(“QLineEdit控件与回显模式”)

    formLayout = QFormLayout()

    nomal = QLineEdit()
    NoEcho = QLineEdit()
    Password  = QLineEdit()
    PasswordEchoOnEdit = QLineEdit()

    formLayout.addRow('nomal',nomal)
    formLayout.addRow('NoEcho', NoEcho)
    formLayout.addRow('Password', Password)
    formLayout.addRow('PasswordEchoOnEdit', PasswordEchoOnEdit)

    nomal.setPlaceholderText('nomal')
    NoEcho.setPlaceholderText('NoEcho')
    Password.setPlaceholderText('Password')
    PasswordEchoOnEdit.setPlaceholderText('PasswordEchoOnEdit')

    nomal.setEchoMode(QLineEdit.Normal)
    NoEcho.setEchoMode(QLineEdit.NoEcho)
    Password.setEchoMode(QLineEdit.Password)
    PasswordEchoOnEdit.setEchoMode(QLineEdit.PasswordEchoOnEdit)

    self.setLayout(formLayout)

if name == ‘main’:
app = QApplication(sys.argv)
main = QLineEditEchoMode()
main.show()
sys.exit(app.exec_())

你可能感兴趣的:(学习例子)