PyQt:带有 Python 2 的新 API [英] PyQt: new API with Python 2
本文介绍了PyQt:带有 Python 2 的新 API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
PyQt 有两个不同的 API:旧的和新的.默认情况下,您使用 Python 2 获得旧 API,使用 Python 3 获得新 API.是否可以使用 Python 2 启用新的 PyQt API?怎么样?
PyQt has two different API's: the old and the new. By default you get the old API with Python 2 and the new API with Python 3. Is it possible to enable the new PyQt API with Python 2? How?
推荐答案
也许你可以尝试使用 sip.setapi
.文档中的一个简单示例:
Perhaps you could try using sip.setapi
. A simple example from the docs:
import sip
sip.setapi('QString', 2)
以及支持的 API 列表:
And a list of the supported APIs:
QDate v1, v2
QDateTime v1, v2
QString v1, v2
QTextStream v1, v2
QTime v1, v2
QUrl v1, v2
QVariant v1, v2
这篇关于PyQt:带有 Python 2 的新 API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文