Updated 2016-02-23 17:37:25 by KJN

BLT is a toolkit offering

  1. a set of widgets, geometry manager
  2. a set of plotting, graph drawing tools.

Attributes  edit

The toolkit is mostly written in C.

As of 2016, BLT the official version is 2.4z, which is not compatible with Tk 8.5 or 8.6. BLT's graphing facilities are unparalleled, and this has led at least three groups to attempt to fork some or all of BLT, and port it to Tk 8.5 or 8.6. See the section "See Also" below.
Website
http://blt.sourceforge.net/
Project Website
http://sourceforge.net/projects/blt/

See Also  edit

  • The most recent functioning version of BLT, v2.4z, uses the internals of Tcl/Tk 8.4 and does not work with Tcl/Tk 8.5/8.6.
  • Development of a new version of BLT is underway in the public CVS repository, but is currently stalled.
  • For these reasons, unofficial forks of BLT have been developed, that port some of BLT's functionality to Tcl/Tk 8.5/8.6. There are at least three such forks:

(1) The RBC Toolkit: Refactored BLT Components includes the "winop" image scaling command, data vectors, and graph/barchart/stripchart widgets for developing graphing applications in Tcl/Tk

(2) TkBLT: part of the ds9 project, TkBLT is a BLT library updated for Tcl 8.6, TEA-compliant and supporting Windows and Mac.

TkBLT includes only the Graph and Barchart Tk widgets, and the Tcl Vector command.
 What:    TkBLT
 Where:   http://sourceforge.net/projects/tkblt/
 Updated: 09/2015 (v3.0)
 Contact: [email protected] (William Joye)

(3) "BLT-2.5": A massively updated BLT that works with Tcl/Tk 8.5. This is the basis for PCM's Wize project.

BLT-2.5 appears to include the whole of BLT, with some changes to the API. It does not claim to be TEA-compliant, or to work with Tcl/Tk 8.6.
 What:    (unofficial) BLT-2.5
 Where:   http://sourceforge.net/projects/wize/ (most up-to-date files)
          http://pdqi.com/w/pw/pdqi/Wize/Blt    (most information)
 Updated: 03/2011 (v2.5.3)
 Contact: Peter C MacDonald [PCM]

Download  edit

The BLT extension can be downloaded from SourceForge at [1]. You can download source code or Windows binary installers for several Tcl/Tk versions there.

You might not want to get the latest version from the BLT cvs at sf.net though. It appears, to at least LV, that the code in the CVS won't compile on machines other than X86...

Note that the tcltk.com URLs below are temporarily out of order. Also note that BLT 2.4v is compatible with Tcl/Tk 8.3.4, and BLT 2.4z, released in October 2002, is compatible with Tcl/Tk 8.4.

Official BLT Toolkit Distribution
 What: BLT toolkit
 Where: http://sf.net/projects/blt/
        http://www.tcltk.com/blt/               (tcltk.com still offline)
        http://www.tcltk.org/blt/slides.pdf     (tcltk.com still offline)
        ftp://tcltk.sourceforge.net/pub/tcltk/blt/BLT2.4z.tar.gz
        http://www.jessikat.demon.co.uk/
        http://jfontain.free.fr/blt-2.4z.spec
        http://jfontain.free.fr/blt-2.4z-1.i386.rpm
        http://jfontain.free.fr/blt-2.4z-1.src.rpm
        http://purl.oclc.org/net/nijtmans/BLT_PATCHES.gz
        ftp://ftp.procplace.com/pub/tcl/sorted/packages-8.0/devel/blt24utb.exe
        http://www.tcl.tk/
        http://sf.net/project/showfiles.php?group_id=18616&release_id=59918
        http://prdownloads.sf.net/blt/BLT2.4x-for-tcl8.4a3.patch
 Description: Library of Tcl and Tk extensions.  Includes a
        a table geometry manager (table), 2D x/y chart (graph),
        barchart (bargraph),
        a new floating point value data structure (vector),
        spline computation support (spline), busy widgets (busy),
        background executation with support for dealing with stdout, stderr,
         and process status (bgexec),
        drag and drop support (drag&drop), hypertext (htext),
        read and write bitmap commands (bitmap),
        minor window manager interfaces (winop),
        and several useful debugging commands (watch and bltdebug).
        It also includes an eps canvas item which allows you to embed
         encapsulated PostScript files into the canvas.
        BLT recently included BLTlite - a Tcl only version of its library
         including the bgexec, spline, tree, vector, bltdebug, and watch
         commands.  BLTlite is automatically used when a Tcl application
         does a package require for BLT without having Tk available.
        BLT 2.4 supports Tk 8.x and has been compiled (by various people)
         on both Unix/Linux and Windows platforms.
        The blt-dev majordomo mailing list is now available for subscription
         at mailto:[email protected].  It will cover BLT development
         issues.
       The sensus site has a port of the latest BLT version to Windows NT
         4.0 SP3.
        The jessikat site has compiled BLT for Win32 using VC++6.0.
        Guy Jennings mailto:[email protected] reports getting
         a useful portion of BLT 2.4a to compile on the Macintosh.
        The multimania and free.fr site files are files used to build
         RedHat rpm files.  Note that the rpm files were build using
         Tcl/Tk 8.4a1.
        The chello site has a set of patches that adds full stubs support,
         fixes blt initialization, fixes config file problems, etc.
        The neosoft .exe happens to be a version of Tcl/Tk 8.3.1 built with
         Stubs and BLT 2.4u on Windows.
        Linux RPMs can be found at the bitwalk site.
        Windows binaries can be found at the SF.net showfiles url.
        The multimania and free.fr site files are files used to build
         RedHat rpm files.  Note that the rpm files were build using
         Tcl/Tk 8.4a1.
        The chello site has a set of patches that adds full stubs support,
         fixes blt initialization, fixes config file problems, etc.
        The ProcPlace .exe happens to be a version of Tcl/Tk 8.3.1 built with
         Stubs and BLT 2.4u on Windows.
        BLT binaries for Windows can be found by searching the site http://www.tcl.tk .
        The above version specific URLs may very well be out of date when
         you visit from here.
        BLT 2.4z is the latest version of BLT available.
 Updated: 04/2003
 Contact: mailto:[email protected] (George A. Howlett)
        mailto:[email protected]
        mailto:[email protected] (Carl Roth)

BLT Commands overview  edit

table
A table geometry manager for Tk, similar to tk's native geometry manager grid. You specify window placements as table row,column positions and windows can also span multiple rows or columns. It also has many options for setting and/or bounding window sizes.
graph
A 2D plotting widget. Plots two variable data in a window with an optional legend and annotations. It has of several components; coordinate axes, crosshairs, a legend, and a collection of elements and tags.
barchart
A barchart widget. Plots two-variable data as rectangular bars in a window. The x-coordinate values designate the position of the bar along the x-axis, while the y-coordinate values designate the magnitude. The barchart widget has of several components; coordinate axes, crosshairs, a legend, and a collection of elements and tags. Example below:

The below example is from Pareto with BLT
stripchart
A stripchart widget [more explanation here]
treeview
A widget displaying a general ordered tree. It is similar to ttk::treeview] that shiped with tk since 8.5.

tree
A tree data object
tabset
A set of widgets which can be used by their self or as part of a tab notebook, similar to ttk::notebook that ships with tk since 8.5. Also supports multi-tiered and/or scrolled tabsets. Notebook pages can be torn off into separate windows and later returned.
vector
Creates a vector of floating point values. The vector's components can be manipulated in three ways: through a Tcl array variable, a Tcl command, or the C API. Vectors inter-operate seamlessly with the plotting widgets - changes to a vector automatically cause the graphics to redraw.
eps
A new Tk canvas item, for handling encapsulated PostScript. Allows you to embed EPS files into a canvas displayign either the embedded preview image or a Tk image that you provide. When you print the canvas, the EPS item will automatically include the EPS file.
spline
Computes a spline fitting a set of data points (x and y vectors) and produces a vector of the interpolated images (y-coordinates) at a given set of x-coordinates.
bgexec
Like Tcl's exec command, bgexec runs a pipeline of Unix commands in the background. Unlike exec, the output of the last process is collected and a global Tcl variable is set upon its completion. bgexec can be used with tkwait to wait for Unix commands to finish while still handling expose events. Intermediate output is also available while the pipeline is active.
busy
Creates a "busy window" which prevents user-interaction when an application is busy. The busy window also provides an easy way to have temporary busy cursors (such as a watch or hourglass).
bitmap
Reads and writes bitmaps from Tcl. New X bitmaps can be defined on-the-fly from Tcl, obviating the need to copy around bitmap files. Other options query loaded X bitmap's dimensions and data.
drag&drop
Provides a drag-and-drop facility for Tk. Information (represented by a token window) can be dragged to and from any Tk window, including those of another Tk application. drag&drop acts as a coordinator, directing Tk send commands between (or within) TCL/Tk applications.
htext
A simple hypertext widget. Combines text and Tk widgets into a single scroll-able window. Tcl commands can be embedded into text, which are invoked as the text is parsed. In addition, Tk widgets can be appended to the window at the current point in the text. Htext can be also used to create scrolled windows of Tk widgets.
winop
Raise, lower, map, or, unmap any window. The raise and lower functions are useful for stacking windows above or below "busy windows".
watch
Arranges for Tcl procedures to be called before and/or after the execution of every Tcl command. This command may be used in the logging, profiling, or tracing of Tcl code.
bltdebug
A simple Tcl command tracing facility useful for debugging Tcl code. Displays each Tcl command before and after substitution along its level in the interpreter on standard error.

More documentation  edit

BLT is (mostly) documented in a number of HTML files that come with the distribution. TclTk.free.fr [2] has the HTML docs online [3] and also covers some screenshots from the BLT example code. But there is also a treasure trove of information in the presentation file 'slides.pdf' in the Files section of the SourceForge project.

Look also at the tcl library files distributed with BLT. These contain some amazingly useful procs that wrap the BLT commands, and are not documented in the HTML pages or in slides.pdf. Some (but not all) of these procs are used in the demo scripts. For an example, see "Blt_ZoomStack" below.

Printed documentation can be found the (older) BOOK Tcl/Tk Tools. This is an excellent reference to BLT with many examples. The BOOK Tcl/Tk in a Nutshell also covers a full chapter on BLT with a very extensive index to all commands.

DKF: I've found reasonable documentation at man-wiki.net just by Googling.

BLT flavours  edit

Recent versions of BLT comes in two flavours. Using BLT without Tk will lead to loading BLTlite containing commands that are useful in Tcl only:
promt> tclsh
% package require BLT
2.4
% info commands blt::*
::blt::tree ::blt::crc32 ::blt::bltdebug ::blt::bgexec ::blt::spline ::blt::vector ::blt::watch
oading Tk before loading BLT will get you the graphical parts too:
prompt> tclsh
% package require Tk
8.4
% package require BLT
2.4
% info commands blt::*
::blt::hiertable ::blt::table ::blt::hierbox ::blt::graph ::blt::vector ::blt::spline ::blt::beep ::blt::ted ::
blt::bitmap ::blt::crc32 ::blt::cutbuffer ::blt::dnd ::blt::watch ::blt::barchart ::blt::tabnotebook ::blt::tree
::blt::drag&drop ::blt::bltdebug ::blt::treeview ::blt::container ::blt::busy ::blt::tabset ::blt::stripchart ::
blt::winop ::blt::htext ::blt::bgexec

So be sure to use the correct sequence of loading the packages, just in case ... There are also versions of BLT compiled into Tcl/Tk. They are called bltwish and bltwish24.

Deployment of applications with BLT  edit

Since BLT is not yet stubs-enabled, you can not use BLT in starkits. One alternative is dqkit which is a "Batteries Included" starkit containing BLT. The other alternative is FreewrapPLUS. Freewrap is a wrapper to build stand-alone executables. The two nice projects are currently the only way for Windows and Linux to get a single-file deployment with BLT included.

The sourceforge project has a version 3.0 in the cvs which eventually will be stubs-enabled, if finished. If it can be finished, it should be very long time ahead, consider no new version has been released for the last 8 years.

For windows there are two 'unofficial' stubs-enabled versions floating around on internet: blt2.4u [4] and blt2.4z [5]

Platforms for BLT  edit

BLT is available for Linux (and other X Windows based Unix systems) (as a source tar.gz, so you can compile for other unixes too) and Windows on the sourceforge page [6]. Binary releases for Linux are available with certain Linux distributions (SuSE for example). There is also a release for MacOS X as part of the fink project [7]. This version is for X11, not for Aqua and will only run with the Tcl/Tk version provided by fink (currently 8.4.7). The only part that currently runs with the Aqua GUI is BLTlite (version 3.0) deployed with the TclTkAquaBI distribution. Another (perhaps better supported) MacOS X version is part of MacPorts (former DarwinPorts). Also this version is for X11 but uses the newer Tcl version 8.4.16. The newest version of DarwinPorts (1.6.0), however, uses Tcl 8.5 and BLT will not build then. The workaround is to install an older port [8]. See also this thread on the DarwinPorts mailing list: [9]

BLT Examples  edit

playing BLT
examples for the novice
BLT - graph - how to draw a sophisticated time axis
an example of how to set up a horizontal time axis on a graph labelled both with dates and intermediate hour markers, and with the dates centralized with respect to the hours.
BLT - graph - create a horizontal label for a vertical axis
shows how to make a horizontal label by extending one of the Y axis tick labels.
BLT - graph - Waveform Viewer
shows that the graph widget can be fast even with Big data sets.
BLT - graph - printing postscript and BLT - graph - printing from Windows
general printing issues and undocumented tricks.
BLT - graph - printing from Windows
not documented in the HTML files. This page shows different ways to print using the Windows operation system.
BLT - stripchart - with realtime update
numeric vector
dicusses one of the features of BLT giving access to fast number handling.
busy
a command to make windows busy. This command has been extracted as a standalone packae using critcl if you need this command and nothing else.
bgexec
has also been extraced to a single package.
Rotate text on a canvas
using BLT.
   How to raise and lower (graph) elements: The BLT author George Howlett explains: [http://groups.google.com/groups?hl=en&lr=&frame=left&th=c1a843b8c6b89355].
Tclodbc + BLT
shows how to create a chart from a recordset obtained through Tclodbc

Tips  edit

KJN: The proc Blt_ZoomStack manages zooming for the graph widget. Add one line of code to your graphing script
Blt_ZoomStack .path.to.graph

and then you can zoom in by selecting areas of the graph with the mouse, and zoom back out by right-clicking. The old graph limits are stored in a stack, so you can zoom in as many times as you like, and then zoom back out through the same sequence of views.

Misc  edit

[RGM] 2005-11-20:

On W2K, using BLT2.4z, I get the following error:
(bin) 6 % Blt_ZoomStack .g1
invalid command name "Blt_ZoomStack"
(bin) 7 %

Any insights? Thanks.

UK: Blt_ZoomStack sits together with other utility procs in <blt_dir>/graph.tcl

Bryan Oakley 2005-06-10: I'm both amazed and disappointed in the BLT graph widgets.

Amazed, in that every time I have an idea to enhance a graph I'm working on, there seems to be an option just for that purpose (multiple axis, zooming, etc). I think it would be a wonderful addition to the core to include such a rich widget. The vector datatype is also quite useful.

Disappointed in that the documentation is incomplete. There seems to be several undocumented features; for example, the widget options -bottomvariable, -topvariable, -data, -datacommand, -barmode, and probably others. Create a stripchart and do .stripchart configure and you'll see several things that don't seem to appear in a man page.

Also, one of the examples shows that it's possible to put the legend into a separate window, but there is no documentation on that feature. That seems like a really useful feature.

Fortunately, one can read the "slides.pdf" file, read the documentation, and scour through the included demos and release notes to find enough information to get the job done.

That being said, BLT rocks. I've long been a fan of bgexec and am now a huge fan of the graph widget and vector datatype.

Other BLT related packages edit

 What: BLT toolkit vector addon
 Where: http://wsd.iitb.fhg.de/%7Ekir/BLTvectorRead.patch
 Description: Patch to add ability to read binary data to BLT 2.4e and f.
 Updated: 08/1998
 Contact: mailto:[email protected] (Harald Kirsch)

 What: Win32 Tcl and Tk patches (jessikat)
 Where: http://www.jessikat.demon.co.uk/
 Description: A variety of patches to Tcl and Tk for Win32s.
        There are patches for wm activate bug, memory debug support,
        listbox justify, cursor, panics, and tkCanvWind.  Also on this
        page are patches and ports of a variety of extensions and
        applications such as DDE, tclStruct, BLT, otcl and a clock
        application.  Tiled widgets problematic, bgexec/busy not
        working, drag&drop ok with dde.  Also a small balloonHelp (blnhlp)
        package is available here as well.  Rotating text didn't make
        it, nor did drag and drop.  Also find a general dll
        caller for the Intel win32 platform which creates a namespace
        called dll containing the dll routines that can be called.
        Contact tested with VC++ 6.0 and Tcl 8.0.4.  It relies on the
        way MSC 4.0.  Site also has a crypt dll.
 Updated: 04/1998
 Contact: mailto:[email protected]

 What: [incr Tk] Lannet Widgets
 Where: ftp://ftp.procplace.com/pub/tcl/sorted/packages-7.6/devel/graphics/itcl_LW-1.0.tar.gz
 Description: Set of itcl widgets for various bells and whistles,
        written while programmer was working at Lannet Ltd., Israel.
        Basically PD.  Requires TkPixmap, BLT, and itcl.
        Works with tcl 7.6, should work with 8.x too. The contact does not
        support it anymore.
 Updated: 10/1998
 Contact: mailto:[email protected] (Mark Sterin)

 What: [incr Tk] table listbox widget
 Where: ftp://ftp.procplace.com/pub/tcl/sorted/packages-7.6/devel/tablelist-1.1.tar.gz
 Description: An itcl table widget based on the Tk Listbox.  Also includes
        checkbuttons or radiobuttons in table format.  Also requires BLT.
        Latest version supports Tk 4.0, while the older version supports
        Tk 3.4.
 Updated: 10/1998
 Contact: mailto:[email protected] (Allan Brighton)

MG 2006-06-19: I just downloaded the Windows binary of BLT for Tcl/Tk 8.4 from SourceForge. Trying to run it gives me the error "c:\windows\system32\autoexec.nt. The system file is not suitable for running MS-DOS and Microsoft Windows applications. Choose 'Close' to terminate the applciation." as though the installer was a 16-bit application. (I'm trying to run it on XP.) Anyone else had this problem, or know of a way around it?

MG, a couple of hours later - Someone has helped me track this problem down to a missing file in my XP install [10], and now the BLT installer works fine. Thanks for your help in fixing it :)

As of late 2006, BLT is not a likely candidate for inclusion in ActiveTcl in the foreseeable future. One of the things that makes BLT a tough sell is it not using TEA as a framework. There may be other issues as well.

LV 2008-07-11:

I'm attempting to build BLT 3 on SPARC Solaris 2.8 using Sun's C compiler and using Tcl/Tk 8.5.3 as the base. I'm constantly running into compile problems. For instance, I finally figured out that I needed to --disable-stubs, and then, I had to edit src/bltGrElem.c and src/bltGrElem.h so they no longer made references to an anonymous union. Now I'm trying to tell BLT configure not to access the Xft libraries, etc. I tried '--without-Xft (as well as the lower case of this). configure says "WARNING: Unrecognized options: --without-Xft".

Anyone worked out this part of the maze?

[YG]: BLT and TCL8.5 TK8.5 is an utter mess. Someone needs to fix it properly. However, I have managed to get the CVS version as of 3 Sept 2008 to build. First, use
./configure --enable-shared --enable-symbols

as your configure line. Then hack the code in bltCoreInit.c and bltExtInit.c and change all instances of EXACT to !EXACT. Remove the #ifndef libXFT if that causes you problems. Compile -- I used icc which works fine apart from a ton of warnings and remarks pointing out the bad code within BLT. This produced something I can use in my application. This is a very dirty hack.

Hope that helps.

ejredwoodcityca 2009-11-27 10:24:35:

I have used BLT for years. Excellent package. I just got a windows 7 (64) machine. Although BLT is a 32 bit app extension, it should run. However, the setup executable is a 16 bit (available from sourceforge) will therefore will not install on w7! (Incidently, the Tcl8.4 binary distribution from sourceforge is also a 16 bit application with the same problem.)

The ActiveTcl distribution will install on windows 7, but for their own reasons, they do not provide a BLT distribution. Any ideas about where to get a 32bit installer version of BLT2.4z? Thanks.

AK Regarding ActiveTcl and BLT please note that the Refactored BLT Components are just one "teacup install rbc" away.

[BRN] - 2012-02-29 17:01:16:

BLT 3.0 compiled using MINGW and working for Tcl8.5.11

I have downloaded BLT3.0 source and compiled using MINGW gcc with Tcl8.5.11 libraries. It is currently working now for Tcl8.5 version.

Martyn Smith Could you let us know where you found BLT3.0 or upload somewhere your source for others to use/update ?

KJN This may be a reference to TkBLT, which is at v3.0 (see "See Also", above)

Page Authors  edit

  [TR]: