# encoding: utf-8
'''===================================================
@Project -> File : qt5003 -> QLineEditEchoMode.py
@IDE : qt5003
@Author : Mr. Batac
@Date : 2020-03-18 20:49
@Desc :
======================================================'''
from PyQt5.QtWidgets import *
import sys
class QLineEditEchoModel(QWidget):
def __init__(self):
super(QLineEditEchoModel, self).__init__()
self.initUI()
def initUI(self):
"""文本输入框有四种回显模式"""
self.setWindowTitle("文本输入框的回显模式")
formLayout = QFormLayout(self)
normalLineEdit = QLineEdit()
noEchoLineEdit = QLineEdit()
passwordEdit =QLineEdit()
passwordEchoPOnEditLineEdit = QLineEdit()
formLayout.addRow("Nomal", normalLineEdit)
formLayout.addRow("NOEcho",noEchoLineEdit)
formLayout.addRow("Password", passwordEdit)
formLayout.addRow("PasswordEchoOnEdit", passwordEchoPOnEditLineEdit)
normalLineEdit.setPlaceholderText("Normal")
noEchoLineEdit.setPlaceholderText("NoEcho")
passwordEdit.setPlaceholderText("Password")
passwordEchoPOnEditLineEdit.setPlaceholderText("PasswordEchoOnEdit")
normalLineEdit.setEchoMode(QLineEdit.Normal)
noEchoLineEdit.setEchoMode(QLineEdit.NoEcho)
passwordEdit.setEchoMode(QLineEdit.Password)
passwordEchoPOnEditLineEdit.setEchoMode(QLineEdit.PasswordEchoOnEdit)
# self.setLayout(formLayout)
if __name__ == '__main__':
app = QApplication(sys.argv)
main = QLineEditEchoModel()
main.show()
sys.exit(app.exec_())
PyQt5-QLabel文本输入框的四种回显模式
猜你喜欢
转载自blog.csdn.net/Batac_Lee/article/details/104953857
今日推荐
周排行