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$ 7 8if {![info exists widgetDemo]} { 9 error "This script should be run from the \"widget\" demo." 10} 11 12package require Tk 13 14set w .icon 15catch {destroy $w} 16toplevel $w 17wm title $w "Iconic Button Demonstration" 18wm iconname $w "icon" 19positionWindow $w 20 21label $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." 22pack $w.msg -side top 23 24## See Code / Dismiss buttons 25set btns [addSeeDismiss $w.buttons $w] 26pack $btns -side bottom -fill x 27 28# Main widget program sets variable tk_demoDirectory 29image create bitmap flagup \ 30 -file [file join $tk_demoDirectory images flagup.xbm] \ 31 -maskfile [file join $tk_demoDirectory images flagup.xbm] 32image create bitmap flagdown \ 33 -file [file join $tk_demoDirectory images flagdown.xbm] \ 34 -maskfile [file join $tk_demoDirectory images flagdown.xbm] 35frame $w.frame -borderwidth 10 36pack $w.frame -side top 37 38checkbutton $w.frame.b1 -image flagdown -selectimage flagup \ 39 -indicatoron 0 40$w.frame.b1 configure -selectcolor [$w.frame.b1 cget -background] 41checkbutton $w.frame.b2 \ 42 -bitmap @[file join $tk_demoDirectory images letters.xbm] \ 43 -indicatoron 0 -selectcolor SeaGreen1 44frame $w.frame.left 45pack $w.frame.left $w.frame.b1 $w.frame.b2 -side left -expand yes -padx 5m 46 47radiobutton $w.frame.left.b3 \ 48 -bitmap @[file join $tk_demoDirectory images letters.xbm] \ 49 -variable letters -value full 50radiobutton $w.frame.left.b4 \ 51 -bitmap @[file join $tk_demoDirectory images noletter.xbm] \ 52 -variable letters -value empty 53pack $w.frame.left.b3 $w.frame.left.b4 -side top -expand yes 54