Skip to content

Commit 8f50633

Browse files
authored
Merge pull request #11694 from matplotlib/toolmanager-before-toolbar-tk
FIX: moving toolmanager initialization up before toolbar
2 parents 3a046ef + 5a110ea commit 8f50633

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/matplotlib/backends/_backend_tk.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,12 +511,13 @@ def __init__(self, canvas, num, window):
511511
self.window.withdraw()
512512
self.set_window_title("Figure %d" % num)
513513
self.canvas = canvas
514+
# If using toolmanager it has to be present when initializing the toolbar
515+
self.toolmanager = self._get_toolmanager()
514516
# packing toolbar first, because if space is getting low, last packed widget is getting shrunk first (-> the canvas)
515517
self.toolbar = self._get_toolbar()
516518
self.canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
517519
self._num = num
518520

519-
self.toolmanager = self._get_toolmanager()
520521
self.statusbar = None
521522

522523
if self.toolmanager:

0 commit comments

Comments
 (0)