1# icon.tcl --
2#
3# This demonstration script creates a toplevel window containing
4# buttons that display bitmaps instead of text.
5#
6# SCCS: @(#) icon.tcl 1.7 96/04/12 11:54:38
7
8set w .icon
9catch {destroy $w}
10toplevel $w
11wm title $w "Iconic Button Demonstration"
12wm iconname $w "icon"
13positionWindow $w
14
15label $w.msg -font $font -wraplength 5i -justify left -text "This window shows three ways of using bitmaps or images in radiobuttons and checkbuttons.  On the left are two radiobuttons, each of which displays a bitmap and an indicator.  In the middle is a checkbutton that displays a different image depending on whether it is selected or not.  On the right is a checkbutton that displays a single bitmap but changes its background color to indicate whether or not it is selected."
16pack $w.msg -side top
17
18frame $w.buttons
19pack $w.buttons -side bottom -fill x -pady 2m
20button $w.buttons.dismiss -text Dismiss -command "destroy $w"
21button $w.buttons.code -text "See Code" -command "showCode $w"
22pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
23
24image create bitmap flagup \
25	-file [file join $tk_library demos images flagup.bmp] \
26	-maskfile [file join $tk_library demos images flagup.bmp]
27image create bitmap flagdown \
28	-file [file join $tk_library demos images flagdown.bmp] \
29	-maskfile [file join $tk_library demos images flagdown.bmp]
30frame $w.frame -borderwidth 10
31pack $w.frame -side top
32
33checkbutton $w.frame.b1 -image flagdown -selectimage flagup \
34	-indicatoron 0
35$w.frame.b1 configure -selectcolor [$w.frame.b1 cget -background]
36checkbutton $w.frame.b2 \
37	-bitmap @[file join $tk_library demos images letters.bmp] \
38	-indicatoron 0 -selectcolor SeaGreen1
39frame $w.frame.left
40pack $w.frame.left $w.frame.b1 $w.frame.b2 -side left -expand yes -padx 5m
41
42radiobutton $w.frame.left.b3 \
43	-bitmap @[file join $tk_library demos images letters.bmp] \
44	-variable letters -value full
45radiobutton $w.frame.left.b4 \
46	-bitmap @[file join $tk_library demos images noletter.bmp] \
47	-variable letters -value empty
48pack $w.frame.left.b3 $w.frame.left.b4 -side top -expand yes
49