16.11.2014 Views

callback patterns and idioms in Python

callback patterns and idioms in Python

callback patterns and idioms in Python

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Events <strong>in</strong> GUI frameworks<br />

the most classic of event-driven fields<br />

e.g, consider Tk<strong>in</strong>ter:<br />

elementary <strong>callback</strong>s e.g. for buttons:<br />

b=Button(parent, text='boo!', comm<strong>and</strong>=...)<br />

flexible, advanced <strong>callback</strong>s <strong>and</strong> events:<br />

wgt.b<strong>in</strong>d(event, h<strong>and</strong>ler)<br />

event: str<strong>in</strong>g describ<strong>in</strong>g the event (e.g.<br />

'', '', '', ...)<br />

h<strong>and</strong>ler: callable tak<strong>in</strong>g Event argument<br />

(w. attributes .widget, .x, .y, .type, ...)<br />

can also b<strong>in</strong>d by class, all, root w<strong>in</strong>dow...<br />

12

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!