3 # This demonstration script creates a toplevel window containing
4 # buttons that display bitmaps instead of text.
6 # RCS: @(#) $Id: icon.tcl,v 1.2 1998/09/14 18:23:28 stanton Exp $
8 if {![info exists widgetDemo
]} {
9 error "This script should be run from the \"widget\" demo."
15 wm title
$w "Iconic Button Demonstration"
19 label $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."
23 pack $w.buttons
-side bottom
-fill x
-pady 2m
24 button $w.buttons.dismiss
-text Dismiss
-command "destroy $w"
25 button $w.buttons.code
-text "See Code" -command "showCode $w"
26 pack $w.buttons.dismiss
$w.buttons.code
-side left
-expand 1
28 image create
bitmap flagup
\
29 -file [file join $tk_library demos images flagup.bmp
] \
30 -maskfile [file join $tk_library demos images flagup.bmp
]
31 image create
bitmap flagdown
\
32 -file [file join $tk_library demos images flagdown.bmp
] \
33 -maskfile [file join $tk_library demos images flagdown.bmp
]
34 frame $w.
frame -borderwidth 10
35 pack $w.
frame -side top
37 checkbutton $w.
frame.b1
-image flagdown
-selectimage flagup
\
39 $w.
frame.b1 configure
-selectcolor [$w.
frame.b1 cget
-background]
40 checkbutton $w.
frame.b2
\
41 -bitmap @[file join $tk_library demos images letters.bmp
] \
42 -indicatoron 0 -selectcolor SeaGreen1
44 pack $w.
frame.left
$w.
frame.b1
$w.
frame.b2
-side left
-expand yes
-padx 5m
46 radiobutton $w.
frame.left.b3
\
47 -bitmap @[file join $tk_library demos images letters.bmp
] \
48 -variable letters
-value full
49 radiobutton $w.
frame.left.b4
\
50 -bitmap @[file join $tk_library demos images noletter.bmp
] \
51 -variable letters
-value empty
52 pack $w.
frame.left.b3
$w.
frame.left.b4
-side top
-expand yes