gale.ui.checkbox module

This file contains the implementation of the class Checkbox: a square toggle firing on_change(checked) on click or on_confirm while focused.

Author: Alejandro Mujica (aledrums@gmail.com)

class gale.ui.checkbox.Checkbox(x, y, size, checked=False, on_change=None, theme=None)[source]

Bases: Widget

A square toggle. Fires on_change(checked) whenever its state flips, either by a mouse click or by on_confirm while focused.

Parameters:
  • x (float)

  • y (float)

  • size (float)

  • checked (bool)

  • on_change (Callable[[bool], None] | None)

  • theme (Theme | None)

toggle()[source]
Return type:

None

render(surface)[source]
Parameters:

surface (Surface)

Return type:

None

on_mouse_click(position, data)[source]
Parameters:
Return type:

bool

on_confirm()[source]
Return type:

bool