How can I use Pyqt with Enthought Canopy

和自甴很熟 提交于 2019-12-08 02:27:30

问题


I had EPD installed and am giving Canopy (Windows 7 64-bit, Academic license) a go. When I first started Canopy, nothing happened (no GUI, no error message) and I realized this is because I had QT_API set to pyqt. Changing qt_api to pyside allows me to start Canopy. After doing this I have checked that pyqt is installed through the Canopy package manager. However Canopy refuses to start with QT_API set to pyqt. How can I fix this? I have a big project with everything in pyqt, so I want to use it.


回答1:


Since Canopy GUI application runs in a different process than Canopy User Python, they can use different GUI backends.

At present, the Canopy GUI application is Pyside-only, because of PyQt's GPL license. I think, therefore, that Canopy GUI should be ignoring QT_API (or internally forcing it), so that you could set it however you want for your application. However from your report this does not seem to be the case.

As a workaround, the first thing that I would try would be to begin your main module (before any backend-dependent imports) by setting os.environ['QT_API'] = 'pyqt'.



来源:https://stackoverflow.com/questions/19001693/how-can-i-use-pyqt-with-enthought-canopy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!