Update tk to version 8.5.5
[git/jnareb-git.git] / mingw / lib / tk8.5 / demos / icon.tcl
blobe8a7ab2aecf2a3307df0ab6fc81f980397510259
1 # icon.tcl --
3 # This demonstration script creates a toplevel window containing
4 # buttons that display bitmaps instead of text.
6 # RCS: @(#) $Id: icon.tcl,v 1.6 2004/12/21 11:56:35 dkf Exp $
8 if {![info exists widgetDemo]} {
9 error "This script should be run from the \"widget\" demo."
12 package require Tk
14 set w .icon
15 catch {destroy $w}
16 toplevel $w
17 wm title $w "Iconic Button Demonstration"
18 wm iconname $w "icon"
19 positionWindow $w
21 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 pack $w.msg -side top
24 ## See Code / Dismiss buttons
25 set btns [addSeeDismiss $w.buttons $w]
26 pack $btns -side bottom -fill x
28 # Main widget program sets variable tk_demoDirectory
29 image create bitmap flagup \
30 -file [file join $tk_demoDirectory images flagup.xbm] \
31 -maskfile [file join $tk_demoDirectory images flagup.xbm]
32 image create bitmap flagdown \
33 -file [file join $tk_demoDirectory images flagdown.xbm] \
34 -maskfile [file join $tk_demoDirectory images flagdown.xbm]
35 frame $w.frame -borderwidth 10
36 pack $w.frame -side top
38 checkbutton $w.frame.b1 -image flagdown -selectimage flagup \
39 -indicatoron 0
40 $w.frame.b1 configure -selectcolor [$w.frame.b1 cget -background]
41 checkbutton $w.frame.b2 \
42 -bitmap @[file join $tk_demoDirectory images letters.xbm] \
43 -indicatoron 0 -selectcolor SeaGreen1
44 frame $w.frame.left
45 pack $w.frame.left $w.frame.b1 $w.frame.b2 -side left -expand yes -padx 5m
47 radiobutton $w.frame.left.b3 \
48 -bitmap @[file join $tk_demoDirectory images letters.xbm] \
49 -variable letters -value full
50 radiobutton $w.frame.left.b4 \
51 -bitmap @[file join $tk_demoDirectory images noletter.xbm] \
52 -variable letters -value empty
53 pack $w.frame.left.b3 $w.frame.left.b4 -side top -expand yes