Вопрос

New Question that builds on this one. I think IPython is a much more suitable alternative for what I am aiming for than the vanilla interpreter

Does anyone know of a class/code I could pickup that instantiates a IPython embedded shell in a QT Widget without launching a kernel ?

I want to be able to provide the intepreter variables of my PyQt app just like one would do when instantiating a native python embedded interpreter. I also want the intepreter to be able make calls to the parent app (via the locals passed to the interpreter).

I have had a cursory glance over spyderlib's IPython interpreter machinery and it seems to instantiate a kernel as part of it's widget initialization.

In case you are wondering what I am trying to achieve, I'm creating a research platform for text analysis. So I'm bridging forum data, stored in a postgres database, to the python nltk project via a GUI application.

Это было полезно?

Решение

The design is that the IPython Qt console widget is just a frontend for a kernel. At present, we've only written a way for the kernel and the frontend to exist in two separate processes. There's work in progress to add a kernel that runs in the same process, which should make what you want possible:

https://github.com/ipython/ipython/pull/2397

If you'd like to test that out, any feedback is welcome. Here's an example of the code you'd need to start it:

https://gist.github.com/3659874#file_embedded_qtconsole.py

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top