Updated 2013-08-13 23:33:06 by ifindleton

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 (1.0.xxx) is built against Tcl 8.5.11, 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.

A source tarball is also available on sourceforge.

An enhanced HTML tarball is also available on sourceforge.

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. The enhanced HTML pages are also available with nice (in my opinion) highlighting of example syntax and extensive hyperlinks. Install it on your own machine for fast access and easy script development.

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:

(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 initialization 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.
 # \
 exec fltkwish "$0" ${1+"$@"}

 # 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 $l.info -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; ...]

[IBF]All of the currently maintained distro for this package can be found at:[1]

Announcement: [2]