Version 19 of Tkcon

Updated 2003-08-05 10:17:56

Purpose: to describe the tkcon application and the special features that make it a worth the moments it takes to download.


TkCon provides a console for interacting with Tcl. This console has an input history, the ability to help loading packages, ability to attach to running Tk applications (if on a system which supports Tk's send command),

[someone add more about the observe and idebug commands in tkcon]

 What: TkCon
 Where: http://tkcon.sourceforge.net/
        http://www.purl.org/net/hobbs/tcl/script/tkcon/
        http://www.purl.org/net/hobbs/tcl/script/widget/
 Description: A Tcl/Tk source standard console.  It not only is a replacement
        for the one that comes with Tk on Windows and Macintosh, but can
        also be used under Unix.  Provides command history, path/proc/variable
        name expansion, multiple interpreter consoles, captures stdout and
        stderr, character and proc highlighting, history searching,
        copy/paste between consoles, communicate with other tk
        interpreters, supports dynamically loadable extensions,
        electric character and proc highlighting.  Latest version supports
        attaching to itcl/Tcl 8 namespaces.
        Regular updates occur - check pack on the WWW page for announcements.
        Requires Tcl/Tk 8.0+ .
        Currently version 2.2 .
        At the widget URL find a fully widgetised version of TkCon.
 Updated: 10/2001
 Contact: mailto:[email protected] (Jeffrey Hobbs)

FPX: In search of a console that I can pop up for interactive debugging, I looked at tkcon and found out that the following code does what I wanted to accomplish:

  namespace eval tkcon {}
  set tkcon::PRIV(showOnStartup) 0
  set tkcon::PRIV(root) .tkcon
  set tkcon::OPT(exec) ""
  source tkcon.tcl

I can now make the tkcon console show up and hide with

  tkcon show
  tkcon hide

respectively, and interact with the main interpreter.

(some minutes later): I have submitted a patch [L1 ] to sourceforge that makes tkcon into a package. With that patch, I can do

  package require tkcon
  tkcon show
  tkcon hide

stevel: tkcon packaged as a starkit can be found at http://mini.net/sdarchive/tkcon.bin . The tkcon "Help/Retrieve latest version" option will update the starkit with the latest CVS version of tkcon.tcl.

LV Steve, the code for retrieve latest version would be useful to turn into a proc that became part of tclkit's std environment, so that all starkits might do that. Or at least, all the ones at sf.net...

This application is also part of the ActiveTcl Batteries Included distribution.


To get tkcon to work using only the main interpreter and the . toplevel, Jeff Hobbs writes:

You need to pass with -exec "" on the command line (in ::argv) or add the following code before you source tkcon:

  namespace eval ::tkcon {}
  # we want to have only the main interpreter
  set ::tkcon::OPT(exec) ""

Arts and crafts of Tcl-Tk programming


[How to debug with tkcon: explain idebug, observe, "hot errors", and state introspection.]

Yes, good idea.


See also: tkcon.cfg


Category Application