MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / enable_wx

Method enable_wx

pydev_ipython/inputhook.py:127–168  ·  view source on GitHub ↗

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

(self, app=None)

Source from the content-addressed store, hash-verified

125 del self._apps[gui]
126
127 def enable_wx(self, app=None):
128 """Enable event loop integration with wxPython.
129
130 Parameters
131 ----------
132 app : WX Application, optional.
133 Running application to use. If not given, we probe WX for an
134 existing application object, and create a new one if none is found.
135
136 Notes
137 -----
138 This methods sets the ``PyOS_InputHook`` for wxPython, which allows
139 the wxPython to integrate with terminal based applications like
140 IPython.
141
142 If ``app`` is not given we probe for an existing one, and return it if
143 found. If no existing app is found, we create an :class:`wx.App` as
144 follows::
145
146 import wx
147 app = wx.App(redirect=False, clearSigInt=False)
148 """
149 import wx
150 from distutils.version import LooseVersion as V
151
152 wx_version = V(wx.__version__).version # @UndefinedVariable
153
154 if wx_version < [2, 8]:
155 raise ValueError("requires wxPython >= 2.8, but you have %s" % wx.__version__) # @UndefinedVariable
156
157 from pydev_ipython.inputhookwx import inputhook_wx
158
159 self.set_inputhook(inputhook_wx)
160 self._current_gui = GUI_WX
161
162 if app is None:
163 app = wx.GetApp() # @UndefinedVariable
164 if app is None:
165 app = wx.App(redirect=False, clearSigInt=False) # @UndefinedVariable
166 app._in_event_loop = True
167 self._apps[GUI_WX] = app
168 return app
169
170 def disable_wx(self):
171 """Disable event loop integration with wxPython.

Callers

nothing calls this directly

Calls 1

set_inputhookMethod · 0.95

Tested by

no test coverage detected