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

Method add_toolitem

lib/matplotlib/backends/backend_gtk4.py:467–489  ·  view source on GitHub ↗
(self, name, group, position, image_file, description,
                     toggle)

Source from the content-addressed store, hash-verified

465 self.append(self._message)
466
467 def add_toolitem(self, name, group, position, image_file, description,
468 toggle):
469 if toggle:
470 button = Gtk.ToggleButton()
471 else:
472 button = Gtk.Button()
473 button.set_label(name)
474 button.add_css_class('flat')
475
476 if image_file is not None:
477 image = Gtk.Image.new_from_gicon(
478 Gio.Icon.new_for_string(image_file))
479 button.set_child(image)
480 button.add_css_class('image-button')
481
482 if position is None:
483 position = -1
484
485 self._add_button(button, group, position)
486 signal = button.connect('clicked', self._call_tool, name)
487 button.set_tooltip_text(description)
488 self._toolitems.setdefault(name, [])
489 self._toolitems[name].append((button, signal))
490
491 def _find_child_at_position(self, group, position):
492 children = [None]

Callers

nothing calls this directly

Calls 4

_add_buttonMethod · 0.95
set_childMethod · 0.80
set_labelMethod · 0.45
connectMethod · 0.45

Tested by

no test coverage detected