Tk Library Source Code


[ Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]


canvas::edit::polyline - Editing a polyline on a canvas

Table Of Contents


package require Tcl 8.5
package require Tk 8.5
package require canvas::edit::points ?0.1?
package require canvas::edit::polyline ?0.2?

::canvas::edit polyline objectName canvas options...
objectName destroy
objectName enable
objectName disable
objectName active
objectName add x y
objectName clear
activeCmd editorObj id
createCmd canvas x y
dataCmd editorObj coordinates


This package provides a class whose instances handle editing a single poly-line (or -gon) on a canvas. Instances can be configured with regard to the visual appearance of the markers denoting the line's vertices, as well as if the line is to be closed or not, and further if a closed line has to be convex or not. Note that instances do not store the edited polyline themselves, but delegate this to a configurable object.


The polyline editor internally uses an instance of package canvas::edit::points, and inherits all the options and behaviours for it. The color options are additionally applied to the line element of this editor

Beyond that it provides 2 options to configure the editing mode, and one option to customize the line/polygon item used to render the line through the points.

The main editing mode is controlled by option -closed for line (i.e. open) versus polygon (i.e. closed). The default is line/open mode.

In polygon/closed mode the option -convex controls if the editor enforces convexity of the polygon, or not. The default is no enforcement of convexity.

The option -line-config enables basic customization of the line/polygon item. Note that it cannot overide the inherited color options.

Class API

Instance API

Instances of the polyline editors provide the following API:


The class command accepts the following options

Bugs, Ideas, Feedback

This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category canvas of the Tklib Trackers. Please also report any ideas for enhancements you may have for either package and/or documentation.


canvas, editing, polyline