GestureStylus

class GestureStylus(**properties: Any)

Superclasses: GestureSingle, Gesture, EventController, Object

GtkGestureStylus is a GtkGesture specific to stylus input.

The provided signals just relay the basic information of the stylus events.

Constructors

class GestureStylus
classmethod new() Gesture

Creates a new GtkGestureStylus.

Methods

class GestureStylus
get_axes(axes: Sequence[AxisUse]) tuple[bool, list[float]]

Returns the current values for the requested axes.

This function must be called from the handler of one of the down, motion, up or proximity signals.

Parameters:

axes – array of requested axes, terminated with %GDK_AXIS_IGNORE

get_axis(axis: AxisUse) tuple[bool, float]

Returns the current value for the requested axis.

This function must be called from the handler of one of the down, motion, up or proximity signals.

Parameters:

axis – requested device axis

get_backlog() tuple[bool, list[TimeCoord]]

Returns the accumulated backlog of tracking information.

By default, GTK will limit rate of input events. On stylus input where accuracy of strokes is paramount, this function returns the accumulated coordinate/timing state before the emission of the current [Gtk.GestureStylus::motion] signal.

This function may only be called within a motion signal handler, the state given in this signal and obtainable through get_axis express the latest (most up-to-date) state in motion history.

The backlog is provided in chronological order.

get_device_tool() DeviceTool | None

Returns the GdkDeviceTool currently driving input through this gesture.

This function must be called from the handler of one of the down, motion, up or proximity signals.

get_stylus_only() bool

Checks whether the gesture is for styluses only.

Stylus-only gestures will signal events exclusively from stylus input devices.

Added in version 4.10.

set_stylus_only(stylus_only: bool) None

Sets the state of stylus-only

If true, the gesture will exclusively handle events from stylus input devices, otherwise it’ll handle events from any pointing device.

Added in version 4.10.

Parameters:

stylus_only – whether the gesture is used exclusively for stylus events

Properties

class GestureStylus
props.stylus_only: bool

If this gesture should exclusively react to stylus input devices.

Added in version 4.10.

Signals

class GestureStylus.signals
down(x: float, y: float) None

Emitted when the stylus touches the device.

Parameters:
  • x – the X coordinate of the stylus event

  • y – the Y coordinate of the stylus event

motion(x: float, y: float) None

Emitted when the stylus moves while touching the device.

Parameters:
  • x – the X coordinate of the stylus event

  • y – the Y coordinate of the stylus event

proximity(x: float, y: float) None

Emitted when the stylus is in proximity of the device.

Parameters:
  • x – the X coordinate of the stylus event

  • y – the Y coordinate of the stylus event

up(x: float, y: float) None

Emitted when the stylus no longer touches the device.

Parameters:
  • x – the X coordinate of the stylus event

  • y – the Y coordinate of the stylus event