Tools - Gaphas

Skip to content
Back to top
View this page

# Tools

Tools are used to interact with the view.

Each tool is basically a function that produces a Gtk.EventController. The event controllers are already configured.

gaphas.tool.hover_tool(find_item_and_handle_at_point: ~typing.Callable[[~gaphas.view.gtkview.GtkView, tuple[float, float]], tuple[~gaphas.item.Item, ~gaphas.handle.Handle | None] | tuple[None, None]] = <function default_find_item_and_handle_at_point>) → gi.repository.Gtk.EventController

  Highlight the currently hovered item.

gaphas.tool.item_tool(find_item_and_handle_at_point: ~typing.Callable[[~gaphas.view.gtkview.GtkView, tuple[float, float]], tuple[~gaphas.item.Item, ~gaphas.handle.Handle | None] | tuple[None, None]] = <function default_find_item_and_handle_at_point>) → gi.repository.Gtk.GestureDrag

  Handle item movement and movement of handles.

gaphas.tool.placement_tool(factory: Callable[[], Item], handle_index: int) → gi.repository.Gtk.GestureDrag

  Place a new item on the model.

gaphas.tool.rubberband_tool(rubberband_state)

  Rubberband selection tool.

  Should be used in conjunction with `RubberbandPainter`.

gaphas.tool.zoom_tool() → gi.repository.Gtk.GestureZoom

  Create a zoom tool as a Gtk.Gesture.

  Note: we need to keep a reference to this gesture, or else it will be destroyed.