I am developing a small Tkinter GUI for drawing matplotlib graphs. (It contains several entries and compiles the plot according to their content.)
I designed my build widget according to http://matplotlib.org/examples/user_interfaces/embedding_in_tk.html , only I use the grid instead of the package:
canvas = FigureCanvasTkAgg(fig, master=root) canvas.get_tk_widget().grid(row=1,column=4,columnspan=3,rowspan=20)
This part works. But embedding the NavigationToolbar in the same way does not occur. Tkinter aborts without errors when I include the lines:
toolbar = NavigationToolbar2TkAgg( canvas, root ) canvas._tkcanvas.grid(row=22,column=4)
I know this is because the NavigationToolbar calls pack inside, and pack and grid do not get along with each other. However, I like the grid and I would not want to redo my entire graphical interface to be able to use NavigationToolbar.
Is there a workaround so I can use NavigationToolbar2TkAgg through the grid? (I found advice for “subclassing and overloading” here , but I don’t know how to do this.)
Any help is much appreciated! Lastalda
Lastalda
source share