Python Interactive with non-blocking Qt event loop

Jun 8, 2012 at 1:56 PM

Can I make Python Interactive (Shift + Alt + F5) start the script in the IPython Qt-console instead of the ordinary IPython console?

I would like to run a script with Qt (PySide) code such as

    w = QSomeWidget()
    w.show()

and then interact with the widget, both directly and through the console.

Coordinator
Jun 8, 2012 at 5:54 PM

If you just want it to run the Qt Console outside of VS's UI I think you could make normal F5 do this by setting the startup script in project properties to launch the QT console script instead of launching a file in your app.  Hopefully you can then do something like pass -i <your_start_file> to it to get the desired end result.

Over in IronPython land there is a "command dispatcher" which can be set for these UI scenarios which cause all executed code to be posted back onto the UI thread to allow interacting with controls via the REPL.  If there was something like that for PyQT you could modify visualstudio_ipython_repl.py so that it dispatched through the dispatcher and allowed you to interact w/ the widget from within the VS repl window using IPython.

Jun 12, 2012 at 7:16 AM
Edited Jun 12, 2012 at 3:29 PM

I asked the wrong question.
I don't need an IPython Qt-console.
I need an IPython console started with the option --gui=qt (or --pylab=qt).

I tried setting Tools > Options >  Python Tools > Interactive Windows > Interpreter Options to --gui=qt.

Then, when I started Python Interactive, I got  the error message

Failed to launch REPL process
Unknown option: --

I also tried gui=qt  without the --. Then I got the error message

Failed to launch REPL process
C:\Python27\python.exe: can't open file 'gui=qt': [Errno 2] No such file or directory

Why do these options not work?

Jul 2, 2012 at 10:02 PM
Edited Jul 2, 2012 at 10:54 PM

I have the same question.

We use PyQT for all our CPython interfacing.

Currently I can't just "run" it from VS2010. It completely falls through and exits. Almost like it never sees the window thread, or kills it immediately.

So, ultimately, just want to be able to run the code from VS rather than fire up an interpreter CLI or scite, etc....

Edit:

AH! Note I am slow. Apparently someone checked in the project with a "starting" file set, and it was reverting to that to run every time.

Now, it works 100% perfectly -- my bad. nothing to see here.