Introduction editBLT is a toolkit offering
- a set of widgets, geometry manager
- a set of plotting, graph drawing tools.
BLT Commands overview edit
- 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.
- 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.
- 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:
- A stripchart widget [more explanation here]
- A widget displaying a general ordered tree. It is similar to ttk::treeview] that shiped with tk since 8.5.
- A tree data object
- 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.
- 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.
- 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.
- 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.
- 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.
- 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).
- 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.
- 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.
- 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.
- Raise, lower, map, or, unmap any window. The raise and lower functions are useful for stacking windows above or below "busy windows".
- 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.
- 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 editBLT is (mostly) documented in a number of HTML files that come with the distribution. TclTk.free.fr  has the HTML docs online  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 editRecent 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::watchLoading 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::bgexecSo 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 editSince 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  and blt2.4z 
Platforms for BLT editBLT 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 . 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 . 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 . See also this thread on the DarwinPorts mailing list: 
BLT Examples edit
- BLT - graph - how to draw a sophisticated time axis is 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 discusses general printing issues and undocumented tricks.
- BLT - graph - printing from Windows are 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 is 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: .
- Tclodbc + BLT shows how to create a chart from a recordset obtained through Tclodbc
Tips editKJN: The proc Blt_ZoomStack manages zooming for the graph widget. Add one line of code to your graphing script
Blt_ZoomStack .path.to.graphand 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.
User comments Nov 20th, 2005 [RGM]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
User comments editBryan Oakley 10-June-2005 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.
Get the package here editThe BLT extension can be downloaded from SourceForge at . 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:firstname.lastname@example.org. 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@example.com 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:firstname.lastname@example.org (George A. Howlett) mailto:email@example.com mailto:firstname.lastname@example.org (Carl Roth)
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@example.com (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:firstname.lastname@example.org 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@example.com (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:firstname.lastname@example.org (Allan Brighton)
(This page was rewritten by TR - 2005-09-20)
MG 19 June 2006 - 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 , and now the BLT installer works fine. Thanks for your help in fixing it :)
Examples for the novice: playing BLT
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 July 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-symbolsas 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:35I 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 soureforge) will therefore will not install on w7! (Incidently, the Tcl8.4 binary distribution from soureforge 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