Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e3d2166

Browse files
tacaswellMeeseeksDev[bot]
authored and
MeeseeksDev[bot]
committed
Backport PR #11694: moving toolmanager initialization up before toolbar
1 parent d3db42c commit e3d2166

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
@@ -472,12 +472,13 @@ def __init__(self, canvas, num, window):
472472
self.window.withdraw()
473473
self.set_window_title("Figure %d" % num)
474474
self.canvas = canvas
475+
# If using toolmanager it has to be present when initializing the toolbar
476+
self.toolmanager = self._get_toolmanager()
475477
# packing toolbar first, because if space is getting low, last packed widget is getting shrunk first (-> the canvas)
476478
self.toolbar = self._get_toolbar()
477479
self.canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
478480
self._num = num
479481

480-
self.toolmanager = self._get_toolmanager()
481482
self.statusbar = None
482483

483484
if self.toolmanager:

0 commit comments

Comments
 (0)