Callbacks

Development

Callbacks (also called Events in other widget sets) are an important way to control behaviour in widget sets.

First parameter is always the widget calling back, the last parameter is alway user_data that is given when registring the callback. Both are ommited below.

Existing Callbacks

  • Button.on_press()
  • RadioButton.on_state_change(new_state)
  • CheckBox.on_state_change(new_state)

Candidates

  • Widget
    • on_keypress(size, key)
    • on_mouse_event(size, event, button, x, y, focus) # finer grained?
  • ListBox
    • on_visible_changed(top, middle, bottom)
  • Scrollbar
    • on_changed(value)
  • add more...

Callback interface

  • register, deregister
  • common code for calling back
  • more than one callback per event? order?
  • callbacks return True if event is finally handled
  • remove/hide callback vars that currently exist (possibly breaking code)
  • see patch on Development