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