1

How do I embed a non-blocking Python shell within a PySide application? It must inherit all active objects and variables. There is a simple widget available for this in wxPython but I cannot find the equivalent widget or approach using Qt/PySide. An example using PyQt4 and IPython no longer works, perhaps because that functionality is now packaged differently within the Jupyter Project. I get the error "ImportError: No module named 'IPython.zmq'". I'm fine with using IPython and Jupyter or not. I'm using Python 3.4.

davideps
  • 541
  • 3
  • 13
  • So what exactly is your question? You know that asking for software recommendations is off-topic on SO, right? – ekhumoro Sep 26 '17 at 18:13
  • I've edited my question above. How do I embed a non-blocking Python shell within a PySide application? – davideps Sep 27 '17 at 05:58
  • I would imagine that embedding a python shell inside a PySide application would be a common practice since Python is a great application scripting language. Could someone explain how to do it? – davideps Sep 29 '17 at 07:29
  • The SO question you linked to gives many examples of how to do it. Not all of them work any more with newer versions of some of the components. So I suppose you will just have to install whatever versions are compatible with your particular setup. – ekhumoro Sep 29 '17 at 12:11
  • Your response makes sense and might be my best option. However, I'd like to wait a bit before marking the question answered since I believe Python is widely embedded in applications, including in Qt applications. Perhaps someone can explain how to accomplish this with the most recent version of Qt. – davideps Oct 01 '17 at 06:47
  • 1
    You can of course use the [code module](https://docs.python.org/3/library/code.html#module-code) in the stdlib to write your own embedded interpreter widget. A little web searching found [pynguin](https://bitbucket.org/leeharr/pynguin/src/56353ddb7c05?at=default), a pyqt4 project which includes a python shell based on the `code.InteractiveConsole` class. I also found [qtstuff](https://github.com/JamesRamm/QtStuff/blob/master/build/lib/QtStuff/console.py) and [pythonconsole](https://bitbucket.org/japczynski/pythonconsole.git). I doubt whether any of these do *exactly* what you want, though. – ekhumoro Oct 01 '17 at 14:44
  • The QtStuff and PythonConsole both look very helpful. Thank you. – davideps Oct 02 '17 at 05:46

0 Answers0