PySide Qt script doesn't launch from Spyder but works from shell

前端 未结 4 1236
旧巷少年郎
旧巷少年郎 2020-12-20 07:26

I have a weird bug in my project that uses PySide for its Qt GUI, and in response I\'m trying to test with simpler code that sets up the environment.

Here is the cod

4条回答
  •  别那么骄傲
    2020-12-20 07:35

    It won't work in Spyder if you try to launch the application into an interactive console because that console is specially configured to import several scientific libraries, automatically show() matplotlib figures, and a few other details. Type scientific at the Spyder console prompt for more details. The result is effectively that a Qt application event loop is already running there.

    To get your application to run inside of Spyder:

    1. Make sure Spyder is configured to open external consoles with PySide and not PyQt. This can be set from Tools>Preferences>Console>External modules>Qt-Python bindings library selection.
    2. With your script active in the editor, hit F6 to open the Run Settings dialog. Select the "Execute in a new dedicated Python interpreter" radio button instead of executing in the current interactive interpreter. Click OK. Now run the script by hitting F5. Debug the script by hitting Ctrl+F5.

提交回复
热议问题