def enable_wx(self, app=None):
import wx<EOL>wx_version = V(wx.__version__).version<EOL>if wx_version < [<NUM_LIT:2>, <NUM_LIT:8>]:<EOL><INDENT>raise ValueError("<STR_LIT>" % wx.__version__)<EOL><DEDENT>from IPython.lib.inputhookwx import inputhook_wx<EOL>self.set_inputhook(inputhook_wx)<EOL>self._current_gui = GUI_WX<EOL>import wx<EOL>if app is None:<EOL><INDENT>app = wx.GetApp()<EOL><DEDENT>if app is None:<EOL><INDENT>app = wx.App(redirect=False, clearSigInt=False)<EOL><DEDENT>app._in_event_loop = True<EOL>self._apps[GUI_WX] = app<EOL>return app<EOL>
Enable event loop integration with wxPython.

        Parameters
        ----------
        app : WX Application, optional.
            Running application to use.  If not given, we probe WX for an
            existing application object, and create a new one if none is found.

        Notes
        -----
        This methods sets the ``PyOS_InputHook`` for wxPython, which allows
        the wxPython to integrate with terminal based applications like
        IPython.

        If ``app`` is not given we probe for an existing one, and return it if
        found.  If no existing app is found, we create an :class:`wx.App` as
        follows::

            import wx
            app = wx.App(redirect=False, clearSigInt=False)