8000 Added spacer to Tk toolbar · matplotlib/matplotlib@1d54580 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1d54580

Browse files
author
David A
committed
Added spacer to Tk toolbar
1 parent 660aa65 commit 1d54580

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/matplotlib/backends/backend_tkagg.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,12 @@ def _Button(self, text, file, command, extension='.gif'):
750750
b.pack(side=Tk.LEFT)
751751
return b
752752

753+
def _Spacer(self):
754+
# Buttons are 30px high, so make this 26px tall with padding to center it
755+
s = Tk.Frame(master=self, height=26, relief=Tk.RIDGE, pady=2, bg="DarkGray")
756+
s.pack(side=Tk.LEFT, padx=5)
757+
return s
758+
753759
def _init_toolbar(self):
754760
xmin, xmax = self.canvas.figure.bbox.intervalx
755761
height, width = 50, xmax-xmin
@@ -761,8 +767,8 @@ def _init_toolbar(self):
761767

762768
for text, tooltip_text, image_file, callback in self.toolitems:
763769
if text is None:
764-
# spacer, unhandled in Tk
765-
pass
770+
# Add a spacer -- we don't need to use the return value for anything
771+
self._Spacer()
766772
else:
767773
button = self._Button(text=text, file=image_file,
768774
command=getattr(self, callback))

0 commit comments

Comments
 (0)
0