MCPcopy Index your code
hub / github.com/ipython/ipython / gui

Method gui

IPython/core/magics/basic.py:475–510  ·  view source on GitHub ↗

Enable or disable IPython GUI event loop integration. %gui [GUINAME] This magic replaces IPython's threaded shells that were activated using the (pylab/wthread/etc.) command line flags. GUI toolkits can now be enabled at runtime and keyboard interrupts shou

(self, parameter_s='')

Source from the content-addressed store, hash-verified

473
474 @line_magic
475 def gui(self, parameter_s=''):
476 """Enable or disable IPython GUI event loop integration.
477
478 %gui [GUINAME]
479
480 This magic replaces IPython's threaded shells that were activated
481 using the (pylab/wthread/etc.) command line flags. GUI toolkits
482 can now be enabled at runtime and keyboard
483 interrupts should work without any problems. The following toolkits
484 are supported: wxPython, PyQt4, PyGTK, Tk and Cocoa (OSX)::
485
486 %gui wx # enable wxPython event loop integration
487 %gui qt # enable PyQt/PySide event loop integration
488 # with the latest version available.
489 %gui qt6 # enable PyQt6/PySide6 event loop integration
490 %gui qt5 # enable PyQt5/PySide2 event loop integration
491 %gui gtk # enable PyGTK event loop integration
492 %gui gtk3 # enable Gtk3 event loop integration
493 %gui gtk4 # enable Gtk4 event loop integration
494 %gui tk # enable Tk event loop integration
495 %gui osx # enable Cocoa event loop integration
496 # (requires %matplotlib 1.1)
497 %gui # disable all event loop integration
498
499 WARNING: after any of these has been called you can simply create
500 an application object, but DO NOT start the event loop yourself, as
501 we have already handled that.
502 """
503 opts, arg = self.parse_options(parameter_s, '')
504 if arg=='': arg = None
505 try:
506 return self.shell.enable_gui(arg)
507 except Exception as e:
508 # print simple error message, rather than traceback if we can't
509 # hook up the GUI
510 error(str(e))
511
512 @skip_doctest
513 @line_magic

Callers

nothing calls this directly

Calls 2

parse_optionsMethod · 0.80
enable_guiMethod · 0.45

Tested by

no test coverage detected