23. The Canvas Widget
This chapter describes Tk’s canvas widget. Canvases allow you to display and manipulate a variety of graphical objects such as rectangles, lines, images, and text strings. The canvas widget supports powerful features of allowing you to tag objects and manipulate all the objects with a given tag. For example, you can move or recolor all of the items with a given tag. You can also create event bindings for tags so that a Tcl script is invoked whenever the pointer passes over a tagged rectangle in a canvas, whenever a button is pressed over a string in the widget, and so on. The tagging and binding mechanisms make it easy to “activate” text and graphics so that they respond to the mouse. This chapter provides an introduction ...
Get Tcl and the Tk Toolkit, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.