La funzione che gestisce l’evento (binding) accede ad alcuni attributi dell’oggetto che ha causato l’evento tramite il suo parametro evt.
def bind_oggetto(evt):
info1 = evt.info1 # Informazioni?
info2 = evt.info2
...
... # Elaborazione
...
oggetto(bind = bind_oggetto, info1 = ..., info2 = ...)
Gli attributi di evt sono diversi a seconda dell’oggetto che ha causato l’evento.
Sono presenti anche gli attributi aggiunti dal codice.
| Attributi | ? | |||||||
|---|---|---|---|---|---|---|---|---|
background | button | |||||||
canvas | canvas | |||||||
checked | checkbox | radio | ||||||
color | button | |||||||
disabled | button | checkbox | menu | radio | slider | |||
index | menu | |||||||
key | (keydown) | |||||||
number | winput | |||||||
selected | menu | |||||||
text | button | checkbox | radio | winput | ||||
type | canvas | |||||||
value | slider |
Gli attributi di evt sono in lettura ma anche in scrittura!