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