【发布时间】:2013-08-16 14:32:52
【问题描述】:
我有一个密码对话框,并且希望在 QLineEdit 的 pyqt 中的字母上加上星号。这可能我在网上找不到任何东西。
【问题讨论】:
我有一个密码对话框,并且希望在 QLineEdit 的 pyqt 中的字母上加上星号。这可能我在网上找不到任何东西。
【问题讨论】:
以QtGui.QLineEdit.Password 作为参数调用LineEdit.setEchoMode。
例如,
import sys
from PyQt4 import QtGui
app = QtGui.QApplication(sys.argv)
w = QtGui.QWidget()
le = QtGui.QLineEdit(w)
le.setEchoMode(QtGui.QLineEdit.Password)
le.show()
w.show()
sys.exit(app.exec_())
【讨论】:
将 QLineEdit 上的 echoMode 属性设置为 QLineEdit::Password。
更多信息here
【讨论】: