Version 0 of Tk demo framework

Updated 2002-04-16 11:55:52

In the Tcl chatroom, Steve Landers and RS discussed the possibility to hook Tk demo scripts into TclTutor or a similar UI, which would display

  • an explanative text
  • the source of the demo (editable(?))
  • A button to run the demo

Thinking slightly further, RS would like to write demo scripts that can run standalone (valid, self-contained Tcl scripts), but also be rendered as Wiki pages, and finally match the planned demo framework, so they could be loaded into that.

The Wiki display (which could be reused for the explanation field) is currently done by enclosing the whole comment in an if 0 {...} command.

The demo framework could first be conceived as a parser that untangles the source script's explanation and code portions. The Run button is trivially done, and should of course catch execution errors (as the code might have been misedited). Maybe a safe editor should be considered too.

For standalone scripts, it is natural that the toplevel "." belongs to them, so the framework would make its own toplevel, and clear "." before running the code.