How to integrate a Ipython console in a PyQT application

Posted by user1800689 on Stack Overflow See other posts from Stack Overflow or by user1800689
Published on 2012-11-05T16:39:18Z Indexed on 2012/11/05 17:00 UTC
Read the original article Hit count: 378

Filed under:
|
|

I am developing PyQt software for my lab. In this software, I am loading different kind of RAW and analyzed data from a mySQL database (usually in arrays).

I would like to integrate an Iython console in a Widget, so that I could interact easily with these data.

I had some difficulties with Ipython 0.13 to do this.
Here is what I already have (The whole code is very long, so I just show the part containing the widget, the Ipython console and the corresponding import line, if you need more, just tell me):

##I load everything useful to my application, including the following line
from IPython.frontend.qt.console.qtconsoleapp import IPythonQtConsoleApp

##then is my whole software
##here is a class containing the Graphical User Interface elements. A button call the following function. self.Shell_Widget is the widget containing the Ipython console, self.MainWindow is the application mainwindow
def EmbeddedIpython(self):
    """
    This function should launch an Ipython console
    """


    self.Shell_Widget = QtGui.QDockWidget(self.MainWindow) #Widget creation
    self.MainWindow.addDockWidget(4,self.Shell_Widget)
    self.Shell_Widget.setMinimumSize(400,420)

    console = IPythonQtConsoleApp() #Console Creation
    console.initialize()
    console.start()


    self.Shell_Widget.show()

So, as wanted, an Ipython console is launched, and seems to work, but I can not access the whole application variables ,arrays etc... I think the Ipython console is launched independently from my software, but here is my limit in programming... Does someone know how to launch Ipython within my application? Maybe a missing parameter, or a different way to integrate Ipython.

for information, this doesn't work: Embedding IPython Qt console in a PyQt application

Thank you for your help!!

© Stack Overflow or respective owner

Related posts about python-2.7

Related posts about pyqt