DEPRECATED since IPython 5.0 Switch amongst GUI input hooks by name. This is a higher level method than :meth:`set_inputhook` - it uses the GUI name to look up a registered object which enables the input hook for that GUI. Parameters ----------
(self, gui=None, app=None)
| 245 | return self._current_gui |
| 246 | |
| 247 | def enable_gui(self, gui=None, app=None): |
| 248 | """DEPRECATED since IPython 5.0 |
| 249 | |
| 250 | Switch amongst GUI input hooks by name. |
| 251 | |
| 252 | This is a higher level method than :meth:`set_inputhook` - it uses the |
| 253 | GUI name to look up a registered object which enables the input hook |
| 254 | for that GUI. |
| 255 | |
| 256 | Parameters |
| 257 | ---------- |
| 258 | gui : optional, string or None |
| 259 | If None (or 'none'), clears input hook, otherwise it must be one |
| 260 | of the recognized GUI names (see ``GUI_*`` constants in module). |
| 261 | |
| 262 | app : optional, existing application object. |
| 263 | For toolkits that have the concept of a global app, you can supply an |
| 264 | existing one. If not given, the toolkit will be probed for one, and if |
| 265 | none is found, a new one will be created. Note that GTK does not have |
| 266 | this concept, and passing an app if ``gui=="GTK"`` will raise an error. |
| 267 | |
| 268 | Returns |
| 269 | ------- |
| 270 | The output of the underlying gui switch routine, typically the actual |
| 271 | PyOS_InputHook wrapper object or the GUI toolkit app created, if there was |
| 272 | one. |
| 273 | """ |
| 274 | warn("`enable_gui` is deprecated since IPython 5.0 and will be removed in future versions.", |
| 275 | DeprecationWarning, stacklevel=2) |
| 276 | if gui in (None, GUI_NONE): |
| 277 | return self.disable_gui() |
| 278 | |
| 279 | if gui in self.aliases: |
| 280 | return self.enable_gui(self.aliases[gui], app) |
| 281 | |
| 282 | try: |
| 283 | gui_hook = self.guihooks[gui] |
| 284 | except KeyError: |
| 285 | e = "Invalid GUI request {!r}, valid ones are: {}" |
| 286 | raise ValueError(e.format(gui, ', '.join(self.guihooks))) |
| 287 | self._current_gui = gui |
| 288 | |
| 289 | app = gui_hook.enable(app) |
| 290 | if app is not None: |
| 291 | app._in_event_loop = True |
| 292 | self.apps[gui] = app |
| 293 | return app |
| 294 | |
| 295 | def disable_gui(self): |
| 296 | """DEPRECATED since IPython 5.0 |
nothing calls this directly
no test coverage detected