Previous section   Next section

Practical Programming in Tcl & Tk, Third Edition
By Brent B. Welch

Table of Contents
Part V.  Tk Details

Chapter 38. Color, Images, and Cursors

This chapter describes the color attributes shared by the Tk widgets. Images and bitmaps can be displayed instead of text by several widgets. This chapter describes commands that create and manipulate images. The cursor attribute controls the shape and color of the mouse cursor when it is over a particular widget. This chapter includes a figure that shows all the cursors available in Tk.

Color is one of the most fun things to play with in a user interface. However, this chapter makes no attempt to improve your taste in color choices; it just describes the attributes that affect color. The tradition of having users change application colors is stronger in UNIX than on the other platforms. This is because all the X toolkits support color tuning via the resource database. Tk carries this tradition to Windows and Macintosh. However, if native look and feel is important, you should not change the default widget colors. On the other hand, tuning colors can provide a flair to your applications, and knowledge of colors is useful for canvas applications.

This chapter describes images, too. The image facility in Tk lets you create an image and then have other Tk widgets display it. The same image can be displayed by many different widgets, multiple times on a canvas, and multiple times within the text widget. If you redefine an image, its display is updated in whatever widgets are displaying it.

The last topic of the chapter is cursors. All widgets can control what the mouse cursor looks like when it is over them. In addition, the widgets that support text input define another cursor, the insert cursor. Its appearance is controlled with a few related attributes.

      Previous section   Next section