[Univ of Cambridge] [Dept of Engineering]
next up previous contents
Next: Motif Up: Examples Previous: Xlib

Tcl/Tk

If you put the following into a file called 'prog' and type 'wish prog' you will see a text area and some buttons.

wm title . "Demo"
wm iconname . "demo"
bind all <Delete> {.text delete insert-1chars}
frame .buttons
pack  .buttons -side bottom -expand y -fill x -pady 2m
button .buttons.dismiss -text Cancel -fg red -bg white -command "exit"
button .buttons.code -text "Start xclock" -fg blue \
        -bg white -command "exec xclock &"
pack .buttons.dismiss .buttons.code -side left -expand 1

label .instructions -justify left -text \
        "Hello.  Click on the buttons or type in the text window."
pack .instructions -side top
text .text -wrap word -bd 2 -yscrollcommand ".scroll set" -setgrid 1 \
	-height 20 -background white
scrollbar .scroll -command ".text yview"
pack .scroll -side right -fill y
pack .text -expand yes -fill both







Tim Love
2001-07-26