qlineedit获取内容数字(点击按钮qlineedit获取内容)

发布日期:2024-12-22 08:07:21     作者:江南别亦蓝     手机:https://m.xinb2b.cn/life/qsu389912.html     违规举报

QLineEdit控件与回显模式


EchoMode()方法用来设置回显示模式,有下列4种回显模式。

NormalNoEchoPasswordPasswordEchoOnEdit

代码如下:

import sysfrom PyQt5.QtWidgets import QApplication,QWidget,QLineEdit,QFormLayoutclass QLineEditDemo(QWidget): def __init__(self): super().__init__() self.setupUI() def setupUI(self): # 创建4个演示用的QLineEdit self.lineEdit_1 = QLineEdit(self) self.lineEdit_2 = QLineEdit(self) self.lineEdit_3 = QLineEdit(self) self.lineEdit_4 = QLineEdit(self) # 设置placehoder self.lineEdit_1.setPlaceholderText("normal") self.lineEdit_2.setPlaceholderText("noEcho") self.lineEdit_3.setPlaceholderText("password") self.lineEdit_4.setPlaceholderText("passwordEchoOnEdit") # 设置回显示模式 self.lineEdit_1.setEchoMode(QLineEdit.Normal) self.lineEdit_2.setEchoMode(QLineEdit.NoEcho) self.lineEdit_3.setEchoMode(QLineEdit.Password) self.lineEdit_4.setEchoMode(QLineEdit.PasswordEchoOnEdit) # 创建一个formLayout self.formLayout = QFormLayout() self.formLayout.addRow("normal",self.lineEdit_1) self.formLayout.addRow("noEcho", self.lineEdit_2) self.formLayout.addRow("password", self.lineEdit_3) self.formLayout.addRow("passwordEchoOnEdit", self.lineEdit_4) self.setLayout(self.formLayout)if __name__ == '__main__': app = QApplication(sys.argv) mainWindow = QLineEditDemo() mainWindow.show() sys.exit(app.exec_())

 
 
本文地址:https://xinb2b.cn/life/qsu389912.html,转载请注明出处。

推荐图文
推荐生活知识
网站首页  |  关于我们  |  联系方式  |  使用协议  |  版权隐私  |  网站地图  |  违规举报  |  蜀ICP备18010318号-4  |  百度地图  | 
Processed in 0.229 second(s), 1 queries, Memory 0.57 M