Version 16 of Tcl Fltk

Updated 2013-04-07 18:57:20 by RLE

Purpose: discuss this non-Tk-based GUI toolkit.

Iain B. Findleton has created a Tcl binding to the Fltk widget set, which is similar in nature to Tk, but is not directly Tk. He advertises, "An Fltk script is about 20 percent [!] the size of a Tk script for the same kind of functionality."

Web presence of TclFltk:

IBF The current version ( is built against Tcl 8.4.15, Tcl 8.5. A version for Tcl 8.6 releases is in the works. No support is going on for the obsolete 0.4.xx.xx versions. Sourceforge has releases for Windows and Linux and ARMv4 machines.

All of the distributions are built using the stubs interface, so there is typically no problem running against any of the post 8.1 Tcl/Tk distributions, although there were some stubs changes in earlier 8.x releases that may cause problems. Using a relatively recent distribution is always a positive approach. The extension is statically linked against the FLTK libraries, so you don't need to have this installed on your machine to use this extension.

Discussion of older versions is at the end of the page.

For those who have fast internet links and enjoy reading technical documentation, a PDF copy of the Tcl Fltk User's Guide is also available. This document is currently quite large and contains a lot of screen shots of the widget set available for Tcl Fltk.

KJN It is clear from the manual that despite the small size of TclFltk, some of its widgets are extremely well crafted for information display; but the examples below have succumbed to 404-rot. Any more modern examples would be appreciated!

IBF I would suggest grabbing the PDF document from sourceforge. Its automatically maintained by my build process and indeed contains a huge number of example and screen shots.

KJN The material below is probably of historical interest only.

For those with a casually curious interest, there are some screen shots of a few applications that can be found at the following links:

  • The TerraGrid Performance Monitor (dead link) is a cluster monitor that shows the performance of an advanced I/O product for use on clusters
  • The Vmstat Cluster Monitor (dead link) is an application that displays the aggregated output from the vmstat application running on Linux clusters

(these applications are not open-source and are no longer available)

In view of the somewhat skeptical observations about the relative code efficiency of the Fltk extension, here is the Tcl Fltk code that implements the GUI for the vmstat performance monitor:

KJN adds: by adding suitable initialisation code, the code fragment below can be made to run. However, the code is missing most of the binding commands that make the GUI work. There is no data feed, for example. Since the screenshot of vmstat (above) is now 404 it is hard to assess the elegance of the code.

 # Build the GUI for this application

 Destroy t copyright

 # Set the rendering scheme to be used

 if { [catch { eval Scheme $Data(Scheme) } reason] } {
        puts stderr "Scheme failed : $reason"

 # Create a package to hold everything

 set f [Package t.all -orientation vertical]

 # Initialize some default behaviour for a CheckButton widget

 Option add CheckButton.relief none
 Option add CheckButton.selectioncolor red
 Option add CheckButton.type toggle
 #Option add CheckButton.state disabled

 # The main header with the logo on top and the status indicators

 set f1 [Package $f.logo -orientation horizontal]
 set Data(Logo) [Image $f1.logo -f $Data(LogoFile) -w 160 -h 60 -tooltip "Click to freeze the display"]
 set f2 [Group $f1.status -r 1 -c 4 -w 655 -h 60 -label "Status"]
 CheckButton $f2.frozen -variable Data(DisplayFrozen) -label "Display Frozen" -readonly true -nocomplain true
 CheckButton $f2.capture -variable Data(Capture) -label "Recording Data" -readonly true -nocomplain true
 CheckButton $f2.replay -variable TapeDeck(CaptureReplay) -label "Replaying Data" -readonly true -nocomplain true
 CheckButton $f2.alerts -variable Alert:Pending -label "Alerts Pending" -readonly true -nocomplain true

 # If the logo is clicked the display is frozen until the next click

 Bind $Data(Logo) <ButtonPress> { %W set -relief sunkenframe ; call FreezeImage %W %b }
 Bind $Data(Logo) <ButtonRelease> { %W set -relief raisedframe }

 # Defaults for a RadialPlot widget

 Option add RadialPlot.relief raised
 Option add RadialPlot.autoscale true

 # Create a scrolable container which has a Frame inside that will automatically layout the radial plots

 set l [Scroll $f.scroll -w 815 -h 480 -scrollbars always_vertical -ystep 240]
 set g [Frame $l.plots -r 4 -c 4 -w 800 -h 960]

 foreach item $Layout {
        set Data($item) [RadialWidget $g.$item -Label.label "[KeyLabel $item]"]

 # The client information and log display widgets are packed together here

 set l [Package $f.clients -orientation horizontal]
 set Data(ClientList) [LabeledListbox $l.clients -Label.label "Client List" \
        -Listbox.command "call SelectClient %W"]
 set g [Package $ -orientation vertical]
 set Data(Log) [LabeledListbox $g.list -Listbox.h 100 -Label.label "Log Messages"]
 set h [Group $g.client -r 3 -c 1 -w 615 -h 100 -label "Current Client Information"]
 LabeledText $h.OS -label "Operating System" -ratio .8 -variable Data(CurrentClient,OS) -relief none -labelrelief none
 LabeledText $h.VMSTAT -label "Vmstat Version" -ratio .8 -variable Data(CurrentClient,VMSTAT) -relief none -labelrelief none
 LabeledText $h.USERDATA -label "User Data" -ratio .8 -variable Data(CurrentClient,USERDATA) -relief none -labelrelief none

 # Display the tape recorder controls

 call TapeDeck $f 815

 # The action buttons along the bottom of the window

 set l [Package $f.actions -orientation horizontal]
 set Data(AlertButton) [Button $l.alerts -label Alerts -command "call AlertManager" \
        -tooltip "Manage user alerts" ]
 Button $l.renormalize -label "Renormalize Plots" -command "call RenormalizePlots" \
        -tooltip "Renormalize all plots"
 Button $l.clearlog -label "Clear Log" -command "$Data(Log) clear" \
        -tooltip "Clear the log display window"
 set Data(Disconnect) [Button $l.disconnect -label Disconnect -command "call DisconnectCurrentClient" -state disabled \
        -tooltip "Disconnect the current client"]
 Button $l.quit -label Quit -command Quit \
        -tooltip "Terminate this application"

The equivalent Tk implementation is beyond my personal abilities, but I wouldn't mind seeing it done by someone else!

[Stuff demonstrated: wallpaper; hurricane tracker; ...]

The links below (Terrascale Technologies, and old format Google Groups) are all dead

Announcement: [L1 ]

Due to the explosion of required distribution support a number of binary distros for the Tcl Fltk extension have been installed for download on the Terrascale Technologies web site [L2 ]

The following distributions can be found:

  • TclFltk for Windows [L3 ] works on Microsoft Windows boxes with the Active State Tcl/Tk 8.4.x distribution
  • TclFltk for Red Hat 9 [L4 ] works on Linux boxes running Tcl/Tk 8.3.x
  • TclFltk for Red Hat 9 AS/3 [L5 ] works on Linux boxes with the RH commercial product (AS/ES/3)
  • TclFltk for SUSE 64 [L6 ] bit works on Opteron based SUSE 8 boxes running Tcl/Tk 8.4.x
  • TclFltk for Fedora Core [L7 ] works on FC based Linux boxes running Tcl/Tk 8.4.x
  • TclFltk User's Guide [L8 ]

The main wrinkles that these distributions iron out are, under 32 bit Linux, changes made in the install path for Tcl/Tk libraries made by the folks at Red Hat. For most of the 32 bit Linux distributions, soft links to the current Tcl/Tk shared libraries will solve any library inconsistencies. The 64 bit SUSE distribution should also run on other 64 bit Linux boxes running main stream distributions, but this has not been tested. Under Windows, the binary is built against the Tcl/Tk 8.4 base, so if you have something older on your windows box you will either need to upgrade, or rename a lot of files. If you are a CYGWIN user under windows, you absolutely need to set the TCLLIBPATH variable to point to the installation location of the extension if you want to run using the CYGWIN Tcl/Tk distribution.