IPython allows GUI event loops to be run in an interactive IPython session. This is done using Python’s PyOS_InputHook hook which Python calls when the raw_input() function is called and waiting for user input. IPython has versions of this hook for wx, pyqt4 and pygtk.
When a GUI program is used interactively within IPython, the event loop of the GUI should not be started. This is because, the PyOS_Inputhook itself is responsible for iterating the GUI event loop.
IPython has facilities for installing the needed input hook for each GUI toolkit and for creating the needed main GUI application object. Usually, these main application objects should be created only once and for some GUI toolkits, special options have to be passed to the application object to enable it to function properly in IPython.
We need to answer the following questions:
Here is some sample code I have been using to debug this issue:
from matplotlib import pyplot as plt
from enthought.traits import api as traits
class Foo(traits.HasTraits):
a = traits.Float()
f = Foo()
f.configure_traits()
plt.plot(range(10))