pyqt QlineEdit 输入密码显示成圆点

xiaoxiao2021-02-28  51

使用自带的函数就可以实现: lineEdit.setEchoMode(QLineEdit.Password)

import struct from PyQt5.QtWidgets import (QMessageBox, QLineEdit) from PyQt5.QtGui import QPixmap {...} class LoginWindow(QtWidgets.QWidget): {...} def __init__(self): super(LoginWindow, self).__init__() # 加载ui文件 loadUi('login.ui', self) # 设置背景图片 background = QPixmap("img/login_background.jpeg") background = background.scaled(self.background_label.width(),self.background_label.width()) self.background_label.setPixmap(background) # 设置输入密码框 self.passwd_lineEdit.setEchoMode(QLineEdit.Password) {.......} def mainpage(): app = QtWidgets.QApplication(sys.argv) login_window = LoginWindow() login_window.show() sys.exit(app.exec_())

转载请注明原文地址: https://www.6miu.com/read-2300014.html

最新回复(0)