Chapter 12

Using the canvas Widget

Chapter 11 described many of the Tk widgets that support GUI programming. This chapter discusses the canvas widget, Tcl events, interaction with the window manager, and use of the Tcl image object. You will learn how events can be connected to a widget or an item drawn on a canvas, and how to use a canvas to build your own GUI widgets.

The canvas is the Tk widget drawing surface. You can draw lines, arrows, rectangles, ovals, text, or random polygons in various colors with various fill styles. You can also insert other Tk windows, or images in X-Bitmap, PPM (Portable Pixmap), PGM (Portable GrayMap), or GIF (Graphical Interface Format) format (other formats are supported in various Tk extensions, discussed in ...

Get Tcl/Tk, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.