Version 5 of Alternative Canvases

Updated 2010-05-19 23:39:24 by AMG

The canvas widget is Tk's workhorse for 2D graphical display, and can handle both bitmap and vector graphics. It was inspired by Joel Bartlett's ezd program, which provides structured graphics in a Scheme environment. In turn, canvas has inspired similar features in other graphical toolkits and even in web browsers via the <canvas> tag [L1 ].

The Tk canvas lacks modern features such as antialiasing, and an alpha channel for transparency/translucency. These might be implemented in future versions of Tk - see Tk 9.0 WishList.

  • antialiasing - (Eh? At least under Aqua it has antialiasing; see CGAntialiasLimit in New Tcl/TkAqua FAQ.)
  • I think this is Mac-only - AFAIK line drawing cannot be anti-aliased on other platforms

This page lists alternatives to the Tk canvas widget for 2D graphics. Some of these are really replacements for Tk itself, others use the feature set of the 3D library OpenGL but in a 2D mode.

Widget Replacements

  • TkZinc (zinc) - does transparency and antialiasing but only if built against OpenGL
  • TkPath

Tk Replacements

  • NexTk and ntkWidget
  • Gnocl has support for the Gnome canvas. Due to Cairo support, this has full object stacking, aliasing and transparency.

OpenGL-based tools

  • 3dcanvas
  • Canvas2½D [L2 ] which uses Tcl3D and claims to be 100% compatible with Tk canvas