3 # This demonstration script creates a toplevel window containing
4 # buttons that display bitmaps instead of text.
6 if {![info exists widgetDemo]} {
7 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."
22 ## See Code / Dismiss buttons
23 set btns [addSeeDismiss $w.buttons $w]
24 pack $btns -side bottom -fill x
26 # Main widget program sets variable tk_demoDirectory
27 image create bitmap flagup \
28 -file [file join $tk_demoDirectory images flagup.xbm] \
29 -maskfile [file join $tk_demoDirectory images flagup.xbm]
30 image create bitmap flagdown \
31 -file [file join $tk_demoDirectory images flagdown.xbm] \
32 -maskfile [file join $tk_demoDirectory images flagdown.xbm]
33 frame $w.frame -borderwidth 10
34 pack $w.frame -side top
36 checkbutton $w.frame.b1 -image flagdown -selectimage flagup \
38 $w.frame.b1 configure -selectcolor [$w.frame.b1 cget -background]
39 checkbutton $w.frame.b2 \
40 -bitmap @[file join $tk_demoDirectory images letters.xbm] \
41 -indicatoron 0 -selectcolor SeaGreen1
43 pack $w.frame.left $w.frame.b1 $w.frame.b2 -side left -expand yes -padx 5m
45 radiobutton $w.frame.left.b3 \
46 -bitmap @[file join $tk_demoDirectory images letters.xbm] \
47 -variable letters -value full
48 radiobutton $w.frame.left.b4 \
49 -bitmap @[file join $tk_demoDirectory images noletter.xbm] \
50 -variable letters -value empty
51 pack $w.frame.left.b3 $w.frame.left.b4 -side top -expand yes