Version 49 of tkpath

Updated 2020-09-10 12:50:30 by RZ


SVG-like rendering for the canvas


Mats Bengtsson
de-facto maintainer
Andrew Shadura


Examples of drawing with Tkpath
arjen 2013-04-11 06:30:07: I have been experimenting with Tkpath a bit.
tkpath - clock
illustraties antialias functionality on an analog clock


Tkpath implements path drawing modeled after SVG. It is very flexible and reproduces all standard drawing canvas items. Features include: opacity, antialiasing, gradient fills, affine transformations, and fill rules. Backends include: CoreGraphics on MacOSX, GDI on Win32, GDI+ on WinXP, Cairo on X11, and Tk drawing as a fallback. Not all backends support all features.


Roy Terry: Released on 2006-07-16. Includes numerous more specialized canvas items sharing the visual traits of the original "path" item and also includes radial patterned gradients. No new release files are available at this time but cvs holds pre-built binaries. See Announce, Tkpath 0.2 , 2006-07-16
adds a ptext text item which supports the same drawing model as the other tkpath items.
announed in 2008-01, is a Tk 8.5 only release (no backward compatibility).
see the section below
a response to the issues discussed in New Canvas, tkpath 0.3.0 release , 2008-07-17

Release: 0.3.0

Tkpath 0.3.0 provides a new canvas widget that is supposed to be 100% compatible with tk::canvas. My major motivation for creating this package was to make something that maps well with SVG graphics.

Tkpath adds mainly two things:

  1. A number of new item types with options that map easily to SVG objects.
  2. A display tree hierarchy with some fancy option inheritance.

The new items are:

  • circle
  • ellipse
  • group
  • path
  • pimage
  • pline
  • polyline
  • ppolygon
  • prect
  • ptext

Most of them can be configured using styles. Instead of setting similar options for each of them, it is possible to create a style, and then use this style for each similar item. When a style is configured, each item using it will be redisplayed.

Using the group item you create a "directory" in the item hierarchy which acts similar to a frame in the widget hierarchy except that options set to the group may be inherited by child items.

The only documentation currently is README.txt , which is very sparse.

Perhaps the easiest way to describe it is to look at these screen shots . Look at the tkpath links.

Note that previous tkpath releases used the tk::canvas item type plugin model for the new item types. This is no longer possible.

Download: just do a cvs checkout and build yourself, or just use the pre-built binaries found in the cvs tree. The only non-standard dependency is on cairo-graphics which is getting common in later linux distros.

Current State

RZ 2020-09-10 see tko for an tkpath oo widget imlementation

RZ 2018-05-18 new repository at

The repository contain the last version from Androwish's tkpath. Additionally the new "canvas image" is implemented and a manpage . Please report error and problems there.

The current maintainer of the project seems to be Andrew Shadura. (The original developer, Mats Bengtsson passed away in 2008.) Andrew's repo is available here .

RZ As of 2018-07-03 one can choose from 3 sources:

  • Andrew's repository
  • The sources inside AndroWish
  • A repository at [L1 ]

What is the state of these repositories? It seems all of them are under development.

dzach 2015-11-17: AndroWish's tkpath seems to be actively maintained with frequent bugfixes and improvements.

RZ I know because I'm contributed some patches :) My goal was only pdf creation support but amazing Christian fixed also some other errors.

I tried at first the sources from Andrew's repository. I changed the 'canvas' command to 'tkp::canvas' and removed the '-angle' option from text entries. Then my drawing application started. The only visible difference was the much smaller text strings. I will try it some more. dzach: You probably need to set both -fontfamily and -fontsize options, as these are a bit different than the -font option of the tk canvas.

chw 2015-11-27: the source code included in AndroWish now supports PDF output thanks to RZ's work. It uses a slightly modified pdf4tcl (also included in AndroWish) for the overall PDF framework. Minor differences to screen output still exist: the PDF routines currently are not able to produce exact output for the special gradient fill methods "repeat" and "reflect". Everything else (including image rotation, tinting, tiling, transparency) should work as designed. It should (cross)compile cleanly for Linux, Windows, and Android.

dzach 2015-11-27: Keeping the same version of AndroWish tkpath as the other implementations may be a problem, since the code is not the same anymore. How about giving it a version, like you did with pdf4tcl, or a new 0.3.4, so that it could be specifically package requested by this version?

I got no reply under Ask and it shall be given so try again.

2013-04-13: I'm trying to install tkpath on Windows XP - I have tcl8.6 installed and works. The instructions say 'download from cvs and install'. I downloaded the binaries from cvs, I put it in /tcl and it is not accessible. The demos don't work. The code doesn't work. How did other users install it? When I know I will update the instructions to be useful.

ekd123 tkpath has been in TEApot IIRC.


yyamasak 2012-06-05: I tried 0.3.1 using an analog clock sample (tkpath - clock). I had to redraw clock hands explicitly by calling "event generate .uhr <Configure>". It seems "coord" canvas subcommand does not perform redrawing.

andras 2014-07-31: If you are looking for advanced examples, some current users of TkPath:

  • Georgios Petasis' Ellogon application (Ellogon 1.9.x uses TkPath 0.2.6)
  • L2Ork's PD project, their repo includes a TkPath fork (link ).
  • Jonas Ferry's TclRobots project (link ). TkPath binaries are checked in under lib/tkpath.

escargo 2014-08-01: The README file provided by the github link for Jonas Ferry's TclRobots project above refers to, which no longerseems to be available. I did find a copy in the Internet Archive:

I couldn't tell what else in the REAMDE might be out of date.

petersteier - 2015-09-09 14:45:34

I tried out to install the package under Ubuntu Server 14.04 LTS (Tcl patchlevel 8.6.1, with apt-get install tcl-dev, tk-dev, libcairo2-dev); a version that worked is from L2Ork's PD project (see above): [L2 ], look in sub-directory pd. It displays the version number 0.3.3. I did not try the repos mentioned here (but was distracted by lots of other wrong information on the web). With ActiveTcl 8.6.1 teacup install does not find tkpath, teacup get downloads several versions, none of which can be installed. Either the config-pathes are wrong, the libcairo2 is incompatible during compiling, or precompiled ELFs are for 32 bit. Also the "original(?)" does not work.

arjen's ven.tcl example looks very nice (and antialiased), however, tkpath-clock looks unchanged, even if the "widget" in the source file is changed to "tkp::widget". Is this behaviour correct? Sould the indexes no be antialiased?

pup - 2015-09-15 10:58:17

canvas_path postscript -file /tmp/ cannot work.

RZ AFAIK postscript output is not implemented in tkpath. If you stick with normal tk canvas items you can use pdf4tcl to print the canvas items. Tkpath items (path, ppolygon etc.) are not (currently?) supported.

nscerqueira To delete all items from the tkpath canvas we have to include the tag of the items .canvas delete tag