O'Reilly logo

Mastering Perl/Tk by Nancy Walsh, Stephen Lidie

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Marking a Widget Busy and Unbusy

When a widget (or application) is busy doing uninterruptable work and doesn’t want to be bothered by mere mortals, the current idiom is to change the cursor shape (to a watch, a clock, or perhaps a spinning ball) as it passes over the busy widget(s). The Tk commands Busy and Unbusy automate this task for us.

$widget->Busy(?-recurse => 1,-option => value>?);

This method configures a -cursor option for $widget and, if -recurse => 1 is specified, all its descendants. If -cursor is not specified, it defaults to watch. Additional configure options are applied to $widget only. It also adds a special tag, Busy, to the bind tags of the widgets configured, such that KeyPress, KeyRelease, ButtonPress, and ButtonRelease events are ignored (with press events generating a call to bell). It then acquires a local grab for $widget.

The state of the widgets and the grab is restored by a call to:

$widget->Unbusy;

For cursor details, see Chapter 23.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required