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