Skip to Main Content
Learning Perl/Tk
book

Learning Perl/Tk

by Nancy Walsh
January 1999
Beginner content levelBeginner
373 pages
9h 43m
English
O'Reilly Media, Inc.
Content preview from Learning Perl/Tk

Chapter 14. Binding Events

Perl/Tk is an event-driven programming language. You design your program to respond to events generated by the program. Event sequences can be pushing a button, moving the mouse, or typing some characters with a keyboard. The relationship between the event sequence and the widget is called a binding.

Each widget provided with Perl/Tk has its own default bindings. For example, the button widget changes color when the mouse pointer is over the button and it invokes a callback that you specified when it is clicked. These are default bindings, ones that are created when you create the widget itself.

You can have your program respond to additional events by using the bind command to assign callbacks to different event sequences; the basic format is:

$widget->bind(sequence, callback);

In addition, you can override the default bindings by creating your own or just removing them.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Perl/Tk

Mastering Perl/Tk

Stephen Lidie, Nancy Walsh

Publisher Resources

ISBN: 1565923146Supplemental ContentCatalog PageErrata