Version 7 of Tcl Fltk

Updated 2004-12-23 17:15:36 by kroc

Purpose: discuss this non-tk based gui toolkit.

Iain B. Findleton announced at [L1 ] the availability of this toolkit [L2 ], based on the Fltk widget set. He has created a Tcl binding 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."

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 [L3 ]

The following distributions can be found:

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

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.

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.

For those who have fast internet links and enjoy reading technical documentation, a copy of the Tcl Fltk User's Guide [L5 ] is also available. This document is currently quite large and contains a lot of screen shots of the widget set available for Tcl Fltk. 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 [] is a cluster monitor that shows the performance of an advanced I/O product for use on clusters
 * The Vmstat Cluster Monitor [] is an application that displays the aggregated output from the vmstat application running on Linux clusters

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:

 # Build the GUI for this application

 Destroy t copyright

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

 set f [Package t.all -orientation vertical]

 # The Terrascale logo

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

 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

 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]"]

 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

 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!

See Fltk Tcl binding for details.

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