PyQt4: AttributeError: 'QLineEdit' 对象没有属性 'setPlaceholderText' [英] PyQt4: AttributeError: 'QLineEdit' object has no attribute 'setPlaceholderText'

查看:49
本文介绍了PyQt4: AttributeError: 'QLineEdit' 对象没有属性 'setPlaceholderText'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 QLineEdit,我想设置一个占位符文本.当我调用 setPlaceholderText(string) 时,我得到一个 AttributeError,但是:

<预><代码>>>>从 PyQt4 导入 QtCore>>>QtCore.PYQT_VERSION_STR'4.7.4'>>>QtCore.QT_VERSION_STR'4.7.0'

来自 QAssistant:

<块引用>

此属性保存行编辑的占位符文本.
...
这个属性是在 Qt 4.7 中引入的.

解决方案

我猜虽然这些库是最新的,但绑定根本不是最新的.

您可能想查看 PySide - 诺基亚项目 (IMO) 的许可问题比 PyQt 少.

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.

解决方案

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.

这篇关于PyQt4: AttributeError: 'QLineEdit' 对象没有属性 'setPlaceholderText'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆