1 #!/usr/bin/env gsi-script
5 ; Copyright (c) 1997-2007 by Marc Feeley, All Rights Reserved.
7 ; Translation into Scheme of Figure 16.14 from Chapter 16 of John
8 ; Ousterhout's "Tcl and the Tk Toolkit".
10 (include "tcltk#.scm") ; import Tcl/Tk procedures and variables
15 (define italic "italic")
16 (define underline "underline")
19 (define (bullet) (display "bullet") (newline))
20 (define (margins) (display "margins") (newline))
24 (tcl ".m" 'add 'checkbutton label: "Bold" variable: bold)
25 (tcl ".m" 'add 'checkbutton label: "Italic" variable: italic)
26 (tcl ".m" 'add 'checkbutton label: "Underline" variable: underline)
27 (tcl ".m" 'add 'separator)
28 (tcl ".m" 'add 'radiobutton label: "Times" variable: font value: "times")
29 (tcl ".m" 'add 'radiobutton label: "Helvetica" variable: font value: "helvetica")
30 (tcl ".m" 'add 'radiobutton label: "Courier" variable: font value: "courier")
31 (tcl ".m" 'add 'separator)
32 (tcl ".m" 'add 'command label: "Insert Bullet" command: bullet)
33 (tcl ".m" 'add 'command label: "Margins and Tabs..." command: margins)
35 (set-variable! font "courier")
40 ; ==> Equivalent program in pure Tcl/Tk:
43 ; .m add checkbutton -label Bold -variable bold
44 ; .m add checkbutton -label Italic -variable italic
45 ; .m add checkbutton -label Underline -variable underline
47 ; .m add radiobutton -label Times -variable font -value times
48 ; .m add radiobutton -label Helvetica -variable font -value helvetica
49 ; .m add radiobutton -label Courier -variable font -value courier
51 ; .m add command -label "Insert Bullet" -command bullet
52 ; .m add command -label "Margins and Tabs..." -command margins