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

Scanning

Use the scan method to implement scanning of the Canvas:

$canvas->scanMark(x, y);
$canvas->scanDragto(x, y);

The first call, $canvas->scanMark( x, y ), records the x and y coordinates and the current Canvas view. The second call, $canvas->scanDragto( x, y ), causes the view in the Canvas to be adjusted by 10 times the difference between these coordinates and the previous ones sent with scanMark. This makes the Canvas look as if it were moved at high speed.

Scrolling Methods

The Canvas widget can be scrolled both horizontally and vertically. The methods xview and yview are used to communicate with the Scrollbars. See Chapter 6 for more information on how these methods work.

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