【发布时间】:2011-12-20 15:38:37
【问题描述】:
我使用这个脚本来启动 qt 设计器,我的自定义小部件(在 Python 3 中)可见:
#!/usr/bin/env python3
import os, sys, subprocess
curDir = os.path.dirname(os.path.abspath(__file__))
params = list(sys.argv) # copy list
params[0] = 'designer' # "designer-qt4" on Linux
widgetsDir = os.path.join(curDir, 'wic', 'widgets')
# add search path for custom widgets and plugins for designer
os.putenv('PYQTDESIGNERPATH', widgetsDir)
subprocess.Popen(params)
但看起来设计师正在使用 python 2.7 来使用小部件插件:
vic@ubuntu:~/wic$ python3 qt_designer.pyw
vic@ubuntu:~/wic$ File "/home/vic/wic/wic/widgets/w_date_edit_plugin.py", line 63
app.exec()
^
SyntaxError: invalid syntax
如何指导设计师使用 Python 3 而不是 Python 2?
我使用 Kubuntu 11.10、KDE 4.7.2、python3.2 和 python2.7,PyQt v4.8.5 compiled for Python 3
【问题讨论】:
标签: python plugins pyqt pyqt4 qt-designer