python kernel crashes on mouse hover over Tkinter window
Question: I want to plot graph in jupiter notebook. When I use the following code

    
    
    %pylab inline  
    import numpy as np
    x=np.linspace(0,10,40)
    plt.plot(x,x**2)
    plt.show()
    

everything works fine but if I change `%pylab inline` to `%pylab tk` or
`%pylab qt` an interactive graph in separate window is shown and when I hover
the mouse over the window python kernel crashes. Does anyone has idea how to
solve this problem and plot graphs in separate windows?

I use Windows 7, Python 3.5.1 from Anaconda 2.4.1 (64-bit) distribution.


Answer: If you want matplotlib interactive, i.e. the plots open in a separate window,
you will want to execute the first cell of your notebook with the following
magic:

    
    
    %matplotlib
    

This should load an interactive backend for your system

If you want to work inline:

    
    
    %matplotlib inline
    

Then you can run your code, but please, do not use `pylab`, use `numpy` and
`matplotlib.pyplot` instead; this will keep your namespaces tidy.

    
    
    import matplotlib.pyplot as plt
    import numpy as np
    
    x = np.linspace(0,10,40)
    plt.plot(x, x**2)
    plt.show()
    

To change back end during a session, you may have to restart your kernel in
`jupyter` for the new backend settings to take effect.

