Show More
@@ -10,11 +10,11 b' from IPython.kernel.zmq.kernelapp import IPKernelApp' | |||
|
10 | 10 | #----------------------------------------------------------------------------- |
|
11 | 11 | # Functions and classes |
|
12 | 12 | #----------------------------------------------------------------------------- |
|
13 |
def p |
|
|
14 |
"""Launch and return an IPython kernel with |
|
|
13 | def mpl_kernel(gui): | |
|
14 | """Launch and return an IPython kernel with matplotlib support for the desired gui | |
|
15 | 15 | """ |
|
16 | 16 | kernel = IPKernelApp.instance() |
|
17 |
kernel.initialize(['python', '-- |
|
|
17 | kernel.initialize(['python', '--matplotlib=%s' % gui, | |
|
18 | 18 | #'--log-level=10' |
|
19 | 19 | ]) |
|
20 | 20 | return kernel |
@@ -23,16 +23,13 b' def pylab_kernel(gui):' | |||
|
23 | 23 | class InternalIPKernel(object): |
|
24 | 24 | |
|
25 | 25 | def init_ipkernel(self, backend): |
|
26 |
# Start IPython kernel with GUI event loop and p |
|
|
27 |
self.ipkernel = p |
|
|
26 | # Start IPython kernel with GUI event loop and mpl support | |
|
27 | self.ipkernel = mpl_kernel(backend) | |
|
28 | 28 | # To create and track active qt consoles |
|
29 | 29 | self.consoles = [] |
|
30 | 30 | |
|
31 | 31 | # This application will also act on the shell user namespace |
|
32 | 32 | self.namespace = self.ipkernel.shell.user_ns |
|
33 | # Keys present at startup so we don't print the entire pylab/numpy | |
|
34 | # namespace when the user clicks the 'namespace' button | |
|
35 | self._init_keys = set(self.namespace.keys()) | |
|
36 | 33 | |
|
37 | 34 | # Example: a variable that will be seen by the user in the shell, and |
|
38 | 35 | # that the GUI modifies (the 'Counter++' button increments it): |
@@ -42,7 +39,7 b' class InternalIPKernel(object):' | |||
|
42 | 39 | def print_namespace(self, evt=None): |
|
43 | 40 | print("\n***Variables in User namespace***") |
|
44 | 41 | for k, v in self.namespace.items(): |
|
45 |
if |
|
|
42 | if not k.startswith('_'): | |
|
46 | 43 | print('%s -> %r' % (k, v)) |
|
47 | 44 | sys.stdout.flush() |
|
48 | 45 |
General Comments 0
You need to be logged in to leave comments.
Login now