Previous section   Next section

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

Table of Contents
Part V.  Tk Details

Chapter 35. Selections and the Clipboard

Cut and paste allows information exchange between applications, and it is built upon a general purpose selection mechanism. The CLIPBOARD selection is used to implement cut and paste on all platforms. X Windows applications may also use the PRIMARY selection. This chapter describes the selection and clipboard commands.

Copy and paste is a basic way to transfer data between just about any two applications. In Tk, copy and paste is based on a general selection mechanism where the selection has a name, type, format, and value. For the most part you can ignore these details because they are handled by the Tk widgets. However, you can also control the selection explicitly. This chapter describes the selection model and the selection and clipboard commands. The last section of this chapter presents an example that implements copy and paste of graphical objects in a canvas.

      Previous section   Next section