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

Chapter 9. The Canvas Widget

The Canvas widget is used mainly for drawing items such as arcs, lines, rectangles, circles, and so on, but you can also place text and other widgets inside a Canvas widget. Here are some examples of how you can use a Canvas widget:

  • Create a drawing program.

  • Display a graph based on input from the user.

  • Create a customized slider.

Figure 9-1 shows a Canvas widget.

Canvas widget

Figure 9-1. Canvas widget

Each item you create in a Canvas widget is assigned a unique item ID, which is a positive integer. Using an item’s ID is a common way of addressing individual Canvas items, but you can devise tag names and use them as well. All Canvas items can have bindings attached to them for easy interaction with the user.

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