Refactored BLT Components


Date12 Oct 2009
Current statealpha release
Date18 May 2018
Last state from above and developmentno release yet

RBC is:

  • BLT's vector, graph, barchart, stripchart, winop, and eps components
  • TEA compliant
  • 3800+ automated test suite, plus many more manual tests
  • Works (for me) on win32, linux 32 bit and linux 64 bit, Tcl/Tk 8.4,8.5, and 8.6beta.

RBC is not (yet):

  • documented
  • experienced
  • beautiful (see pkgIndex.tcl for an example)
  • free from Tcl/Tk internals
  • including Zoom-Stack
  • tested with starkits

Replace BLT with RBC


package require BLT
namespace import blt::*


package require rbc
namespace import rbc::*

The rest should work. This procedure was tested with

Of course, you need to append the path to the rbc package for this to work. So something like this should be in your tcl file.

lappend auto_path <path-to-your-rbc-files>

RZ rbc fails to compile under msys/mingw and tcl8.5.11 because of the use of 'tkpWinRopModes[]'. Changing of all 'tkpWinRopModes' strings in files rbcGrLine.c, rbcTile.c and rbcWinDraw.c into 'tkpWinRopMode1' fixed the problem.

Starkit for Tclkit 8.4, 8.5 and 8.6 (Linux-x86 and Win32-x86)

Try out a small demo by:

 $ tclkit-8.4.19
 % source rbc0.1.kit
 % package require rbc
 % source rbc0.1.kit/lib/rbc0.1/demo.tcl

tested as well with tclkit-8.5.11 and tclkit-8.6b2

JHJL I have hacked the ZoomStack code in graph.tcl and seem to have got interactive zooming to work (for me). In the functions PushZoom & PopZoom I commented out the calls to "busy" and put in an event generate as follows:

# busy hold $graph
event generate $graph <Configure>
# busy release $graph

I am not sure that <Configure> is the right event to use but I had previously noticed that resizing the window caused a redraw which used the newly set axis max/min limits.

JHJL Same trick works for ActiveLegends i.e. put event generate $graph <Configure> in ActivateLegend, DeactivateLegend and HighlightLegend.

Not sure why it works, suspect BLT (RBC) minimizes redraws etc to improve performance and that the <Configure> forces it's hand...

JBR : I have recently replaced a bunch of BLT plots with RBC. It seems to work, but I have two complaints:

1. The cursor disapears when moved into the plot. 2. The plot axis labels are slightly clipped.

Can anyone help me with these?


LV any code to demonstrate this issue?

dcg - 2010-01-23 11:33:34

Any chance for bgexec and some of the other esoteric functions from BLT to be included in RBC at some point? I use both bgexec and blt::winop resample (which is an undocumented sub feature of the winop command to resize images with various smoothing filters) extensively. These features of BLT are why I have stayed with TCL 4.8.19 for so long.

ape - 2010-11-08

Refactoring BLT was a very good idea but it was a year ago, with an alpha release... Does anyone continue to work on it ?

boomer - 2011-05-12 10:41:38

I desperately needed some of the BLT components and also wanted to be able to use the new font handling for the Graph widget (huge improvement in rotated text). I was happy to find rbc and a font handling improvement patch (see ). After that I added the bgexec, tabset and drag&drop commands and also fixed a few bugs found during testing.

Note that the font handling improvements only work with Tcl/Tk 8.6.

This version of rbc is tested under Windows (32-bit only) and Linux (32- and 64-bit).

If anyone is interested I'm happy to share what I've got so far.

JHJLWould like to try it out, can you provide a download link?

EG Rbc is great, but is in need of love. I've already identified some drawbacks on its source code which might become problematic in the future:

  • The graph widgets interface are still string based, instead of Tcl_Obj() based.
  • There are some dark bugs on the management of mark elements.
  • Some functions use direct access to interp->result (fixed in the font improvement patch).
  • Rbc is based on an ancient version of Blt; the CVS version has some useful functionality which can be backported to Rbc.

There are also parts which can be cleaned up or deprecated. I'd like to get rid of the variable access to vectors. I'd like to add additional methods to the vector instance command such as max, min, average, etc. Compare the command

 rbc::vector expr max($vector)


 $vector max

Since Rbc is not (IMO) a drop-in replacement of Blt, I think it can start evolving on a different, user driven direction.

boomer - 2011-05-16 04:17:18

Sorry JHJL, I don't have access to a public server but I'll be happy to email my version to anyone.

EG, some of the things you mention are fixed in my version and I agree with you that it should evolve separate from BLT. I'd be happy to help if someone else is willing to take the lead.

EG Please send patches to Rbc tracker.

boomer: It is really no point in uploading patches since I've added so much and changed just about every file. Unfortunately I can't upload the whole thing either because of a size limitation of 256kB. Suggestions?

jbr 2012-02-06 Patch to rbc 0.1 for Tcl8.6b2

[john@hopper src]$ diff rbc/generic/ rbc-86/generic/rbcVecMath.c 
<         Tcl_SetErrorCode(interp, "ARITH", "DOMAIN", interp->result,
>         Tcl_SetErrorCode(interp, "ARITH", "DOMAIN", Tcl_GetStringResult(interp),
<             Tcl_SetErrorCode(interp, "ARITH", "UNDERFLOW", interp->result,
>             Tcl_SetErrorCode(interp, "ARITH", "UNDERFLOW", Tcl_GetStringResult(interp),
<             Tcl_SetErrorCode(interp, "ARITH", "OVERFLOW", interp->result,
>             Tcl_SetErrorCode(interp, "ARITH", "OVERFLOW", Tcl_GetStringResult(interp),
<         Tcl_SetErrorCode(interp, "ARITH", "UNKNOWN", interp->result,
>         Tcl_SetErrorCode(interp, "ARITH", "UNKNOWN", Tcl_GetStringResult(interp),