[IPython-dev] more on embedding Qt/IPythonWidget

Piotr Zolnierczuk dasneutron at gmail.com
Tue Apr 24 13:45:13 EDT 2012


I got a tip  from Raymond Bosman (back in February) that I thought
went posted to this mailing list, so I assumed it was non-issue
anymore.


Here it is:
========================================================

Hi Piotr,

I came across the same problem that no prompt was available in the
IPython Qt Widget.
The solution is to add:

km.start_channels()

The example code becomes:


from IPython.frontend.qt.console.ipython_widget import IPythonWidget
from IPython.lib import guisupport

from IPython.frontend.qt.kernelmanager import QtKernelManager

def main():
   app = guisupport.get_app_qt4()

   km = QtKernelManager()
   km.start_kernel()
   km.start_channels()
   control = IPythonWidget()
   control.gui_completion = True
   control.kernel_manager = km
   control.show()

   guisupport.start_event_loop_qt4(app)


# Application entry point.
if __name__ == '__main__':
   main()

===========================

Cheers

Piotr


On Mon, Apr 23, 2012 at 12:56 AM, Fernando Perez <fperez.net at gmail.com> wrote:
> Hi Piotr,
>
> On Tue, Jan 24, 2012 at 7:33 AM, Piotr Zolnierczuk
> <piotr.zolnierczuk at gmail.com> wrote:
>> Hi again,
>>
>> I am trying to understand the IPythonWidget (eventually I would like to
>> embed it in my Qt app)
>> I am playing with Robert Kern's example  https://gist.github.com/1416977
>> and it does what I need. What I would like to add is the ability to connect
>> to the kernel from another qtconsole.
>>
>> So I tried to replace his QtKernelManager  with the "stock" one (changed one
>> line in his example.py)
>>
>> -from qtkernelmanager import QtKernelManager
>> +from IPython.frontend.qt.kernelmanager import QtKernelManager
>>
>> But now there's no prompt. What am I missing?
>
> Did you manage to solve this issue?  Just a few days ago Ray Osborn
> posted he'd successfully done the same thing, perhaps we could at
> least get some sharing of the 'hack that works' posted in a canonical
> place, until there's time for a cleaner refactoring...
>
> f
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev



More information about the IPython-dev mailing list