Show More
@@ -8,7 +8,7 b' IPython Events' | |||||
8 | Extension code can register callbacks functions which will be called on specific |
|
8 | Extension code can register callbacks functions which will be called on specific | |
9 | events within the IPython code. You can see the current list of available |
|
9 | events within the IPython code. You can see the current list of available | |
10 | callbacks, and the parameters that will be passed with each, in the callback |
|
10 | callbacks, and the parameters that will be passed with each, in the callback | |
11 |
prototype functions defined in :mod:`IPython.core. |
|
11 | prototype functions defined in :mod:`IPython.core.events`. | |
12 |
|
12 | |||
13 | To register callbacks, use :meth:`IPython.core.events.EventManager.register`. |
|
13 | To register callbacks, use :meth:`IPython.core.events.EventManager.register`. | |
14 | For example:: |
|
14 | For example:: |
@@ -7,11 +7,24 b' loop, so you can use both a GUI and an interactive prompt together. IPython' | |||||
7 | supports a number of common GUI toolkits, but from IPython 3.0, it is possible |
|
7 | supports a number of common GUI toolkits, but from IPython 3.0, it is possible | |
8 | to integrate other event loops without modifying IPython itself. |
|
8 | to integrate other event loops without modifying IPython itself. | |
9 |
|
9 | |||
10 | Terminal IPython handles event loops very differently from the IPython kernel, |
|
10 | Supported event loops include ``qt4``, ``qt5``, ``gtk2``, ``gtk3``, ``wx``, | |
11 | so different steps are needed to integrate with each. |
|
11 | ``osx`` and ``tk``. Make sure the event loop you specify matches the GUI | |
|
12 | toolkit used by your own code. | |||
12 |
|
13 | |||
13 | Event loops in the terminal |
|
14 | To make IPython GUI event loop integration occur automatically at every | |
14 | --------------------------- |
|
15 | startup, set the ``c.InteractiveShellApp.gui`` configuration key in your | |
|
16 | IPython profile (see :ref:`setting_config`). | |||
|
17 | ||||
|
18 | If the event loop you use is supported by IPython, turning on event loop | |||
|
19 | integration follows the steps just described whether you use Terminal IPython | |||
|
20 | or an IPython kernel. | |||
|
21 | ||||
|
22 | However, the way Terminal IPython handles event loops is very different from | |||
|
23 | the way IPython kernel does, so if you need to integrate with a new kind of | |||
|
24 | event loop, different steps are needed to integrate with each. | |||
|
25 | ||||
|
26 | Integrating with a new event loop in the terminal | |||
|
27 | ------------------------------------------------- | |||
15 |
|
28 | |||
16 | .. versionchanged:: 5.0 |
|
29 | .. versionchanged:: 5.0 | |
17 |
|
30 | |||
@@ -48,8 +61,8 b' Once you have defined this function, register it with IPython:' | |||||
48 | by running ``%gui foo``. |
|
61 | by running ``%gui foo``. | |
49 |
|
62 | |||
50 |
|
63 | |||
51 |
|
|
64 | Integrating with a new event loop in the kernel | |
52 | ------------------------- |
|
65 | ----------------------------------------------- | |
53 |
|
66 | |||
54 | The kernel runs its own event loop, so it's simpler to integrate with others. |
|
67 | The kernel runs its own event loop, so it's simpler to integrate with others. | |
55 | IPython allows the other event loop to take control, but it must call |
|
68 | IPython allows the other event loop to take control, but it must call |
General Comments 0
You need to be logged in to leave comments.
Login now