简体   繁体   English

PyQt4:AttributeError:'QLineEdit'对象没有属性'setPlaceholderText'

[英]PyQt4: AttributeError: 'QLineEdit' object has no attribute 'setPlaceholderText'

I have a QLineEdit, and I want to set a placeholder text. 我有一个QLineEdit,我想设置一个占位符文本。 When I call setPlaceholderText(string) I get an AttributeError, but: 当我调用setPlaceholderText(string)出现AttributeError,但是:

>>> from PyQt4 import QtCore
>>> QtCore.PYQT_VERSION_STR
'4.7.4'
>>> QtCore.QT_VERSION_STR
'4.7.0'

and from the QAssistant: 从QAssistant:

This property holds the line edit's placeholder text. 此属性保存行编辑的占位符文本。
... ...
This property was introduced in Qt 4.7. 此属性在Qt 4.7中引入。

I would guess that although the libraries are very recent, the bindings are simply not that up to date. 我猜想,尽管这些库是最新的,但是绑定并不是最新的。

You might want to check out PySide - a Nokia project with (IMO) fewer license issues than PyQt. 您可能要检查PySide-与(PyQt)相比,具有(IMO)许可证问题少的诺基亚项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM