MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _Button

Method _Button

lib/matplotlib/backends/_backend_tk.py:874–900  ·  view source on GitHub ↗
(self, text, image_file, toggle, command)

Source from the content-addressed store, hash-verified

872 button.configure(**image_kwargs, height='18p', width='18p')
873
874 def _Button(self, text, image_file, toggle, command):
875 if not toggle:
876 b = tk.Button(
877 master=self, text=text, command=command,
878 relief="flat", overrelief="groove", borderwidth=1,
879 )
880 else:
881 # There is a bug in tkinter included in some python 3.6 versions
882 # that without this variable, produces a "visual" toggling of
883 # other near checkbuttons
884 # https://bugs.python.org/issue29402
885 # https://bugs.python.org/issue25684
886 var = tk.IntVar(master=self)
887 b = tk.Checkbutton(
888 master=self, text=text, command=command, indicatoron=False,
889 variable=var, offrelief="flat", overrelief="groove",
890 borderwidth=1
891 )
892 b.var = var
893 b._image_file = image_file
894 if image_file is not None:
895 # Explicit class because ToolbarTk calls _Button.
896 NavigationToolbar2Tk._set_image_for_button(self, b)
897 else:
898 b.configure(font=self._label_font)
899 b.pack(side=tk.LEFT)
900 return b
901
902 def _Spacer(self):
903 # Buttons are also 18pt high.

Callers 2

__init__Method · 0.95
add_toolitemMethod · 0.80

Calls 1

_set_image_for_buttonMethod · 0.80

Tested by

no test coverage detected