[IPython-dev] Uniform way of integrating event loops among different IDE's

Almar Klein almar.klein@gmail....
Tue Aug 24 10:06:37 CDT 2010


Hi Fernando and others,

I'm developing an IDE for Python (http://code.google.com/p/iep/) that is
capable of integrating the event loop of several GUI toolkits. On a side
note, I used much code of IPython as inspiration on how to do that, so
thanks for that.

I saw in the IPython documentation that IPython users can detect whether
IPython hijacked the event loop as follows (for wx):

try:
    from IPython import appstart_wx
    appstart_wx(app)
except ImportError:
     app.MainLoop()

A very nifty feature indeed. However, building further on this, wouldn't it
be nice if people could perform this trick regardless of in which IDE or
shell the code is running? Therefore I propose to insert an object in the
GUI's module to indicate that the GUI event loop does not need to be
entered. I currently use for my IDE:

import wx
if not hasattr(wx, '_integratedEventLoop'):
    app = wx.PySimpleApp()
    app.MainLoop()

Currently, _integratedEventLoop is a string with the value 'IEP', indicating
who hijacked the main loop. I'm not sure what IPythons appstart_* function
does, but the inserted object might just as well be a function that needs to
be called (using the app instance as an argument, but how to call it for
fltk or gtk then?).

I'm interested to know what you think of this idea.
  Almar

PS: for PyQt4, I would propose inserting the object both in the PyQt4 and
PyQt4.QtGui namespaces.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-dev/attachments/20100824/02c8a880/attachment.html 


More information about the IPython-dev mailing list