gpt4 book ai didi

python - 如何创建 QList 对象?

转载 作者:行者123 更新时间:2023-11-30 23:20:57 25 4
gpt4 key购买 nike

我导入了以下 2 个库:

from PyQt4.QtCore import *
from PyQt4.QtGui import *

我正在尝试创建一个 QList 对象,如下所示:

self.myList = QList()

我收到错误:

NameError: global name 'QList' is not defined

QList 在 QtCore 下,我希望它能够工作。

请建议如何纠正它。

最佳答案

QList 类是提供列表的模板类。仅在 C++ 中可用。但在 python 中,它有可供使用的 python list 数据类型。如果你想使用像列表这样的行为,你可以使用类似QListpython list

我对此有引用有用的教程。请阅读本文来实现python list;

Python 列表:http://www.tutorialspoint.com/python/python_lists.htm

并且,官方 Python 列表引用;

数据结构:https://docs.python.org/2/tutorial/datastructures.html

<小时/>

问候,

关于python - 如何创建 QList 对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25159732/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com