全球最资讯丨气轻PyQt6 03 文本框(QLineEdit)密码
来源:哔哩哔哩
发布时间:2023-02-06 08:04:28
from PyQt6.QtWidgets import *
(资料图片)
from PyQt6.QtGui import QFont
import sys
class PyQt603(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.setWindowTitle('气轻PyQt6') # 设置窗口标题
self.resize(700, 300) # 设置窗口大小
self.edit = QLineEdit(self) # 输入框
self.edit.setGeometry(10, 0,240, 40) # 设置位置和大小
self.edit.setText('edit')
self.edit.setFont(QFont('Arial',20))
self.edit.setEchoMode(QLineEdit.EchoMode.Password) # 密码
self.show()
if __name__ == '__main__':
app = QApplication(sys.argv)
window = PyQt603()
sys.exit(app.exec())
执行结果
x