PyQt4: AttributeError: 'QLineEdit' object has no attribute 'setPlaceholderText'

十年热恋 提交于 2019-12-12 02:09:53

问题


I have a QLineEdit, and I want to set a placeholder text. When I call setPlaceholderText(string) I get an AttributeError, but:

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

and from the QAssistant:

This property holds the line edit's placeholder text.
...
This property was introduced in Qt 4.7.


回答1:


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.



来源:https://stackoverflow.com/questions/3952850/pyqt4-attributeerror-qlineedit-object-has-no-attribute-setplaceholdertext

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!