43. Handling Events

This chapter describes Tcl’s library functions for event handling. The code you will write for event handling is divided into three parts. The first part consists of code that creates event handlers: it informs Tcl that certain callback functions should be invoked when particular events occur. The second part consists of the callbacks themselves. The third part consists of top-level code that invokes the Tcl event dispatcher to process events.

Tcl supports two principal kinds of events: file events and timer events. Tcl also allows you to create idle callbacks, which cause functions to be invoked when Tcl runs out of other things to do; idle callbacks are used in Tk to defer redisplays and other time-consuming computations ...

Get Tcl and the Tk Toolkit, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.