TIP 482: Record Tk demo directory information

FlightAware bounty program for improvements to Tcl and certain Tcl packages.
Author:         Stuart Cassoff <stwo@users.sourceforge.net>
State:          Accepted
Type:           Project
Vote:           Done
Created:        03-Nov-2017
Keywords:       Tk, demos, configuration
Tcl-Version:    8.7
Tk-Branch:      tk-stu-pkg


The Tk demos can be installed anywhere but this location is not recorded anywhere. This TIP proposes recording the demo directory location.


The Tk demos can be installed in a non-default directory by overriding the Makefile variable DEMO_INSTALL_DIR at install-time. Since this information isn't recorded anywhere there is no practical way for an external entity to determine the demo install directory.


  • Add an overridable configure-time variable DEMO_DIR that by default contains the current default demo install directory and have this propagate through the build system.

  • Record the configured demo directory in tkConfig.sh, tk.pc and ::tk::pkgconfig.

Platform Considerations

  • Unix, MacOSX
    • This TIP works as described.
  • Windows
    • This TIP works as described however saved configuration information about directories is generally less useful on Windows because Tk is almost never installed into the same directories that are recorded in the pre-built files.

Current Uncertainties as of 2017/11/21:

  • The function GetWidgetDemoPath in macosx/tkMacOSXMenus.c uses a different method to retrieve the value of the widget demo path. Is this ok?
  • Only tested on Unix.

Reference Implementation

The reference implementation is available in the tk-stu-pkg branch. http://core.tcl.tk/tk/timeline?r=tk-stu-pkg

The code is licensed under the same license as Tk.

See Also

TIP #483 [483]: Improved TIP #59 implementation for Tk.


This document has been placed in the public domain.