MCPcopy Create free account
hub / github.com/ipython/ipython / enable

Method enable

IPython/lib/inputhook.py:338–383  ·  view source on GitHub ↗

DEPRECATED since IPython 5.0 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

(self, app=None)

Source from the content-addressed store, hash-verified

336@inputhook_manager.register('wx')
337class WxInputHook(InputHookBase):
338 def enable(self, app=None):
339 """DEPRECATED since IPython 5.0
340
341 Enable event loop integration with wxPython.
342
343 Parameters
344 ----------
345 app : WX Application, optional.
346 Running application to use. If not given, we probe WX for an
347 existing application object, and create a new one if none is found.
348
349 Notes
350 -----
351 This methods sets the ``PyOS_InputHook`` for wxPython, which allows
352 the wxPython to integrate with terminal based applications like
353 IPython.
354
355 If ``app`` is not given we probe for an existing one, and return it if
356 found. If no existing app is found, we create an :class:`wx.App` as
357 follows::
358
359 import wx
360 app = wx.App(redirect=False, clearSigInt=False)
361 """
362 warn("This function is deprecated since IPython 5.0 and will be removed in future versions.",
363 DeprecationWarning, stacklevel=2)
364 import wx
365
366 wx_version = V(wx.__version__).version
367
368 if wx_version < [2, 8]:
369 raise ValueError("requires wxPython >= 2.8, but you have %s" % wx.__version__)
370
371 from IPython.lib.inputhookwx import inputhook_wx
372 self.manager.set_inputhook(inputhook_wx)
373 if _use_appnope():
374 from appnope import nope
375 nope()
376
377 import wx
378 if app is None:
379 app = wx.GetApp()
380 if app is None:
381 app = wx.App(redirect=False, clearSigInt=False)
382
383 return app
384
385 def disable(self):
386 """DEPRECATED since IPython 5.0

Callers 3

timeitMethod · 0.45
enable_guiMethod · 0.45
enableMethod · 0.45

Calls 2

_use_appnopeFunction · 0.85
set_inputhookMethod · 0.80

Tested by

no test coverage detected