]> git.zerfleddert.de Git - micropolis/blob - src/tk/library/demos/mkButton.tcl
Import Micropolis from http://www.donhopkins.com/home/micropolis/
[micropolis] / src / tk / library / demos / mkButton.tcl
1 # mkButton w
2 #
3 # Create a top-level window that displays a bunch of buttons.
4 #
5 # Arguments:
6 # w - Name to use for new top-level window.
7
8 proc mkButton {{w .b1}} {
9 catch {destroy $w}
10 toplevel $w
11 dpos $w
12 wm title $w "Button Demonstration"
13 wm iconname $w "Buttons"
14 message $w.msg -font -Adobe-times-medium-r-normal--*-180* -aspect 300 \
15 -text "Four buttons are displayed below. If you click on a button, it will change the background of the button area to the color indicated in the button. Click the \"OK\" button when you've seen enough."
16 frame $w.frame -borderwidth 10
17 pack append $w.frame \
18 [button $w.frame.b1 -text "Peach Puff" \
19 -command "$w.frame config -bg PeachPuff1"] {top pady 4 expand} \
20 [button $w.frame.b2 -text "Light Blue" \
21 -command "$w.frame config -bg LightBlue1"] {top pady 4 expand} \
22 [button $w.frame.b3 -text "Sea Green" \
23 -command "$w.frame config -bg SeaGreen2"] {top pady 4 expand} \
24 [button $w.frame.b4 -text "Yellow" \
25 -command "$w.frame config -bg Yellow1"] {top pady 4 expand}
26 button $w.ok -text OK -command "destroy $w"
27
28 pack append $w $w.msg {top fill} $w.frame {top expand fill} \
29 $w.ok {bottom fill}
30 }
Impressum, Datenschutz