From d4bcdd07bb19db45e3ef2c8203d37786034991cc Mon Sep 17 00:00:00 2001 From: richardsheridan Date: Mon, 21 Jun 2021 10:06:54 -0400 Subject: [PATCH] give Font a root widget Fixes toolbar for tk.NoDefaultRoot() users --- lib/matplotlib/backends/_backend_tk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/backends/_backend_tk.py b/lib/matplotlib/backends/_backend_tk.py index 01c8005cc7eb..3537781334af 100644 --- a/lib/matplotlib/backends/_backend_tk.py +++ b/lib/matplotlib/backends/_backend_tk.py @@ -543,7 +543,7 @@ def __init__(self, canvas, window, *, pack_toolbar=True): if tooltip_text is not None: ToolTip.createToolTip(button, tooltip_text) - self._label_font = tkinter.font.Font(size=10) + self._label_font = tkinter.font.Font(root=window, size=10) # This filler item ensures the toolbar is always at least two text # lines high. Otherwise the canvas gets redrawn as the mouse hovers