Skip to content

Commit e8bcd91

Browse files
authored
Merge pull request #26128 from anntzer/tkt
Add missing spacer in tk toolmanager toolbar.
2 parents fa21b42 + 7704b57 commit e8bcd91

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/matplotlib/backends/_backend_tk.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,13 @@ def __init__(self, toolmanager, window=None):
972972
width=int(width), height=int(height),
973973
borderwidth=2)
974974
self._label_font = tkinter.font.Font(size=10)
975+
# This filler item ensures the toolbar is always at least two text
976+
# lines high. Otherwise the canvas gets redrawn as the mouse hovers
977+
# over images because those use two-line messages which resize the
978+
# toolbar.
979+
label = tk.Label(master=self, font=self._label_font,
980+
text='\N{NO-BREAK SPACE}\n\N{NO-BREAK SPACE}')
981+
label.pack(side=tk.RIGHT)
975982
self._message = tk.StringVar(master=self)
976983
self._message_label = tk.Label(master=self, font=self._label_font,
977984
textvariable=self._message)

0 commit comments

Comments
 (0)