Tcl Bindings for the Fltk Tool kit


The Fast Light Tool kit (Fltk) is a cross platform GUI development tool kit that implements its widget set using native GUI primitives on Windows and X Windows platforms, as well as others. The Fltk extension to the Tcl/Tk application development environment is a Tcl stubs based dynamically loadable extension that implements a set of bindings to the Fltk tool kit that allows the development of GUI based applications using the Tcl scripting language


The current implementation of the Fltk extension, version 0.4, is at a fairly advanced stage of development and is being released at this time to permit interested users to test the implementation and to both identify bugs and to suggest improvements. The current package is, however, stable and fairly extensive, and can be used to develop elaborate applications.

The Fltk extension is completely compatible with existing Tcl and Tk applications and any Tcl/Tk extension packages that are available or in use. Fltk widgets and commands co-exist with Tcl/Tk command sets. If desired, the Fltk command set can be consigned to a Tcl namespace so that no conflict with other packages occurs.


This extension provides the entire Fltk widget set. Fltk widgets are more or less equivalent to those provided by the Tk widget set. While Tk widgets benefit from a decade of refinement, Fltk widgets are somewhat lighter in feature richness while maintaining the basic functionality needed for GUI development. There are also several widgets not found in Tk, such as a Chart widget, an Image widget and a Multi-column Listbox widget. The package also provides a number of predefined dialogs for things like getting file names, passwords and asking users to choose between options.

The Fltk widget set supports schemes for rendering widgets in different visual presentations. Currently supported schemes include the standard widget rendering scheme that has a clean consistent appearance on both Unix and Windows platforms, as well as an OpenGL based rendering scheme that can be used to create visually interesting widgets. Additional schemes permit the use of images and computed patterns as shins, as well as the native plastic scheme that is part of the FLTK library.

The use of container widgets greatly simplifies geometry management under Fltk. There is no specific geometry manager per se. Mega-widgets are assembled using containers that provide automatic geometry management of their children, automatic scrollbar management, widget resize management and notebook tabs without the need for significant support code.

The Fltk widgets can co-exist with the Tk widget set. The current version does not support mixed mega-widgets using the two packages, however, an existing Tk application can be extended using Fltk widgets. The two widget sets can interact using suitable Tcl glue code. You can, for instance, have top level windows for both widget sets on the screen at the same time, and use event handlers to support interactions between the widget sets. You can wrap a Tk top level inside an Fltk top level using an event handler to control the geometry of the Tk top level, although I personally find this to be heretical.

Because of the C++ implementation of the Fltk extension, the creation of new mega-widgets is somewhat simplified when compared to the Tk API. No knowledge of the X tool kit is required. Generally speaking, creating new widget or mega-widget involves writing 1 parameterless drawing function and implementation of some standard functions for the getting and setting of option values. Since the Fltk tool kit uses native GUI facilities on the target platforms, there is no need to maintain Windows code and X code using, for instance, #ifdef __WIN32__ expressions. This also means there is no performance loss going from X to Windows. The Fltk distribution also includes a GUI based mega-widget development tool that makes it very easy to create complex mega-widgets which can then be included in the extension package.

The Fltk extension implements several language related constructs that make the initialization of widget options convenient. An option database management interface that is portable across platforms is used to support a powerful scheme for configuring applications.

The Fltk extension supports a number of popular image formats, including BMP,PNG,JPEG and TIFF. Extension widgets can use images as wallpaper and for button faces. Image widgets can be updated from disk at rates that make it feasible to implement image animation applications for some types of technical applications. The package supports the import of image data from sensor instruments that provide rectangular arrays of intensity data.

The Fltk extension implements an enhanced event mechanism that supports user defined as well as standard window based events. The extension also provides for the binding of event handlers to Tcl variables and for the binding of Tcl variables to widget properties.

The Fltk extension implements support for multiple native languages and idioms. If desired, scripts could be written entirely in a native language, or in some mix of native languages, or in some idiom that only people in your village will understand.

Installing the Fltk extension

Space limitations prevent the distribution of the source tree from this site. If you really want to build from source, request the source tree from the author. Note that the source build requires the installation of additional source packages for the Image extension, the installation of the source tree for the FLTK tool kit, and the source tree for the Tcl/Tk packages.

 Binary Installation

The following binary packages are available for download:

Tcl/Fltk for Windows
All windows environments running the Tcl/Tk 8.4 series of releases
Tcl/Fltk for 32 bit Linux
All Environments running the Tcl/Tk 8.4 series of releases
Tcl/Fltk for 64 bit Linux
All Linux x86_64 (IA 64) machines with Tcl/Tk 8.4 series releases
Tcl/Fltk for ARM4 Linux
ARM based platforms such as the Openmoko Freerunner

Download the Linux or the Windows binary distribution package as required by your system. Under Linux the binary works with glibc 1 (The more recent version found on RH and other distributions). There is a script named install_binaries that does the required things for the Linux distributions. Under Windows, you need to unzip the distribution into the current Tcl library directory. You can find this directory by issuing the following command from the Tcl shell console prompt:

     set tcl_library

There are 2 options for using the package. You can start the wish shell and issue the command:

     package require Fltk

which, if your installation is done correctly, will load the extension and install the extension command set. Under Linux, you can use the command fltkwish, which will load a modified wish shell that automatically loads the extension package.

Under Windows, the current distribution has been generated using static libraries and the MINGW cross compiler. As such, you should be able to run it without any other stuff on your machine. On my windows box I have the Tcl/Tk binary distribution for the 8.3 release, and the extension package works just fine. I have not tested a box without the Tcl/Tk installation yet. There is a fltkwish.exe file that should work out of the box. Alternatively, you can create a .wishrc file that contains the following commands:

     wm withdraw .
     package require Fltk 

The Tcl/Tk documentation included with the Tcl/Tk distribution contains information on .wishrc files.

It is also possible to use Fltk as a Tcl extension. In order to do this, however, you must arrange for Tcl to enter its event loop once you have configured your widgets. As released, the binary packages found here do not permit this use, as Tk is automatically loaded, however you can build from source to get the required binaries. To get a Tcl only version you need to remove the call to Tk_InitStubs in the package initialization code.

Source Installation

Under Linux, download the source archive, unpack the archive, run the configure script and then do a make. If you have all the required components then things should work just fine. If you are missing components, have a file layout that is not the same as mine, or are not on a Linux RH 9.x box, you will probably have to modify the Makefile. This extension is written in C++, so you need a C++ compiler. The Linux application was built with gcc 2.96.2. Earlier gcc compilers have found some parts of the code difficult to swallow. In particular, initialization of static instances of classes appears to have somewhat variable quality of support in other compilers.

Under Windows, use the same source archive, however, there is no makefile . I used the MINGW cross compiler to build the Windows distribution using the Linux makefile. If you support the Microsoft empire, I don't know what you need to do. Theoretically, the Linux Makefile should be directly useable under CYGWIN as well.

I used the public domain versions of the PNG, TIFF and JPEG libraries which are found in many places on the web. The source distribution for Windows has the static libraries I used to build the binaries.


There is an extensive document in PDF format that works nicely with the Adobe Acrobat viewers available for popular browsers, and the Linux O/S has utilities like gv and xpdf, as well as the Linux version of Acrobat, that will display the document as well. No man pages have been written yet. Be aware that this document is rather large, so if you download it via a telephone modem, it will take time!

Comments and Suggestions

If you have comments, suggestions, bug reports or contributions, please send them to me at the following address:

and refer to the Tcl Fltk Extension in the subject line. I would welcome any contributions in the areas of documentation, additional widgets, additional scheme implementations and any other areas that would reduce the amount of labour I foresee for myself in getting this project to completion.

License and Copyright

This software is Copyright (C) I.B.Findleton, 2000-2006. All Rights Reserved

Currently, I am granting a license to use, modify, copy and re-distribute the package for private, non-commercial purposes. Commercial redistribution is prohibited without the express written permission of the author.


This software is offered without warranty of any kind. This software is currently under development and could possibly cause loss of or damage to data or programs on your computer. USE AT YOUR OWN RISK AND EXPENSE.