PLplot Extensions to Tcl
Prev | Chapter 14. Building an Extended WISH | Next

## PLplot Extensions to Tcl

Following the paradigm described above, PLplot provides extensions to Tcl as well, designed to allow the use of PLplot from Tcl/Tk programs. Essentially the idea here is to allow PLplot programmers to achieve two goals:

- To access PLplot facilities from their own extended WISH and/or Tcl/Tk user interface scripts.

- To have PLplot display its output in a window integrated directly into the rest of their Tcl/Tk interface.

For instance, prior to PLplot 5.0, if a programmer wanted to use PLplot in a Tcl/Tk application, the best he could manage was to call the PLplot C API from compiled C code, and get the output via the Xwin driver, which would display in it's own toplevel window. In other words, there was no integration, and the result was pretty sloppy.

With PLplot 5.0, there is now a supported Tcl interface to PLplot functionality. This is provided through a “family” of PLplot megawidgets implemented in [incr Tcl]. Using this interface, a programmer can get a PLplot window/widget into a Tk interface as easily as:

    	PLWin .plw
    	pack .plw

Actually, there's the update/init business—need to clear that up.

The `PLWin` class then mirrors much of the PLplot C API, so that a user can generate plots in the PLplot widget entirely from Tcl. This is demonstrated in the `tk02` demo,

Prev | Up | Next
Introduction to [incr Tcl] | Home | Custom Extensions to Tcl