Qt 图编辑器的工作 PySide 示例?

Working PySide example of Qt diagram editor?

当 运行 和 PySide Diagram Scene example(大约 2010 年)时,我得到以下错误。是否有可用的基本图表编辑器的更新示例?

C:\Python34\python.exe C:/Users/dle/Documents/Programming/Python/diagramscene.py
Traceback (most recent call last):
  File "C:/Users/dle/Documents/Programming/Python/diagramscene.py", line 11, in <module>
import diagramscene_rc
  File "C:\Users\dle\Documents\Programming\Python\diagramscene_rc.py", line 404, in <module>
qInitResources()
  File "C:\Users\dle\Documents\Programming\Python\diagramscene_rc.py", line 399, in qInitResources
QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
TypeError: 'qRegisterResourceData' called with wrong argument types:
  qRegisterResourceData(int, str, str, str)
Supported signatures:
  qRegisterResourceData(int, unicode, unicode, unicode)

问题是文件 diagramscene_rc.py 已为 python2 生成,要解决它,您必须重新编译该文件,因为它会在文件夹中打开一个终端并执行以下命令:

pyside-rcc diagramscene.qrc -o diagramscene_rc.py -py3

或者,在赋值变量之前放置字母 b,如下所示:

qt_resource_data = "\
\x00\x00\x01\x12\ 
...
qt_resource_name = "\
\x00\x06\
...
qt_resource_struct = "\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
....

至:

qt_resource_data = b"\
\x00\x00\x01\x12\ 
...
qt_resource_name = b"\
\x00\x06\
...
qt_resource_struct = b"\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
....