pythonware.com products ::: library ::: search ::: daily Python-URL!

Library

An Introduction to Tkinter

The Canvas Widget :::

A Django site.
   

The Canvas Widget

Back   Next   

 Chapter 13. The Canvas Widget

The Canvas widget provides structured graphics facilities for Tkinter. This is a highly versatile widget which are used to draw graphs and plots, create graphics editors, and implement various kinds of custom widgets.

To display things on the canvas, you create one or more canvas items, which are placed in a stack. By default, new items are drawn on top of items already on the canvas. Tkinter provides lots of methods allowing you to manipulate the items in various ways. Among other things, you can attach (bind) event callbacks to individual items.

 When to use the Canvas Widget

The canvas is a general purpose widget, which is typically used to display and edit graphs and other drawings.

Another common use for this widget is to implement various kinds of custom widgets. For example, you can use a canvas as a completion bar, by drawing and updating a rectangle object.

Back   Next