Improve Gambit REPL (toolbar is semi transparent and the alpha can be set with set...
[gambit-c.git] / examples / tcltk / fig16-14.scm
blob4018541676c218869f290a887e6b9e6e89972964
1 #!/usr/bin/env gsi-script
3 ; File: "fig16-14.scm"
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
12 (load "tcltk")
14 (define bold      "bold")
15 (define italic    "italic")
16 (define underline "underline")
17 (define font      "font")
19 (define (bullet)  (display "bullet")  (newline))
20 (define (margins) (display "margins") (newline))
22 (menu ".m")
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")
37 (tcl ".m" 'post 0 0)
40 ; ==> Equivalent program in pure Tcl/Tk:
42 ; menu .m
43 ; .m add checkbutton -label Bold -variable bold
44 ; .m add checkbutton -label Italic -variable italic
45 ; .m add checkbutton -label Underline -variable underline
46 ; .m add separator
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
50 ; .m add separator
51 ; .m add command -label "Insert Bullet" -command bullet
52 ; .m add command -label "Margins and Tabs..." -command margins
54 ; set font courier
56 ; proc bullet {} {
57 ;   puts "bullet"
58 ; }
60 ; proc margins {} {
61 ;   puts "margins"
62 ; }
64 ; .m post 0 0