【问题标题】:PyQt -How do make my text have an asterisk on it?PyQt - 如何让我的文本带有星号?
【发布时间】:2013-08-16 14:32:52
【问题描述】:

我有一个密码对话框,并且希望在 QLineEdit 的 pyqt 中的字母上加上星号。这可能我在网上找不到任何东西。

【问题讨论】:

    标签: python passwords pyqt


    【解决方案1】:

    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_())
    

    【讨论】:

      【解决方案2】:

      将 QLineEdit 上的 echoMode 属性设置为 QLineEdit::Password

      更多信息here

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-01-24
        • 1970-01-01
        • 1970-01-01
        • 2019-11-06
        • 1970-01-01
        • 2011-11-23
        • 1970-01-01
        • 2013-06-29
        相关资源
        最近更新 更多