Python - Matplotlib in Tkinter: The toolbar pan and zoom doesnt change the cursor
<p>I've been developing a tkinter app, which has a matplotlib graph embeded in it. The problem i am having right now is :</p>

<p>Allthough the functionality of the toolbar is working, it doesnt change the cursor which makes a worse user experience since you cant tell if you are zooming or not.
From what i have seen from various documentation and online tutorials this shouldnt be an issue.</p>

<p>From what i read, the toolbar should even makes changing cursor harder, since it overrides to cursor all the time when pan or zoom is selected. I am posting the related parts of my code, please let me know if you see something that doesnt add up, or anything that i might be missing. </p>

<p>Any suggestion is much appriciated!</p>

<pre><code>from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg

class Controller(tk.Tk): 
    self.canvass = FigureCanvasTkAgg(self.plots, self)
    self.canvass.show()
    self.canvass.get_tk_widget().grid(row=1, column=0, sticky="news") 

    self.toolbar_frame = tk.Frame(self, width=410, height=30)
    self.toolbar_frame.config(relief="sunken", borderwidth=1)
    self.toolbar_frame.pack_propagate(flag=False)
    self.toolbar_frame.grid(column=0, row=3, sticky="w")

    self.toolbar = NavigationToolbar2TkAgg(self.canvass, self.toolbar_frame)
    self.toolbar.pack()
    self.toolbar.update()
</code></pre>

<p><strong>It turned out putting the toolbar into a frame causes that weird behavior. I just took a simple 'matplotlib in tkinter embedding' example which was working and modified it to use a frame as i did in my code, and the same problem occoured.</strong></p>

<p>I need the frame because normally the toolbar uses pack and i dont want to change the whole layout just because of this, since i'have used grid all along.</p>

<p>Well I have encountered the same problem too, and oddly enough this is caused by the canvas and the toolbar not having the same master.  Just making a new frame and putting the canvas and the toolbar in it will solve the problem. You still can place that frame with grid in your layout .</p>

python python-3.x matplotlib tkinter