OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / ALPHALINUX5 / util / ALPHALINUX5 / lib / tk8.0 / demos / bitmap.tcl
1 # bitmap.tcl --
2 #
3 # This demonstration script creates a toplevel window that displays
4 # all of Tk's built-in bitmaps.
5 #
6 # SCCS: @(#) bitmap.tcl 1.6 97/03/02 16:19:20
7
8 if {![info exists widgetDemo]} {
9     error "This script should be run from the \"widget\" demo."
10 }
11
12 # bitmapRow --
13 # Create a row of bitmap items in a window.
14 #
15 # Arguments:
16 # w -           The window that is to contain the row.
17 # args -        The names of one or more bitmaps, which will be displayed
18 #               in a new row across the bottom of w along with their
19 #               names.
20
21 proc bitmapRow {w args} {
22     frame $w
23     pack $w -side top -fill both
24     set i 0
25     foreach bitmap $args {
26         frame $w.$i
27         pack $w.$i -side left -fill both -pady .25c -padx .25c
28         label $w.$i.bitmap -bitmap $bitmap
29         label $w.$i.label -text $bitmap -width 9
30         pack $w.$i.label $w.$i.bitmap -side bottom
31         incr i
32     }
33 }
34
35 set w .bitmap
36 global tk_library
37 catch {destroy $w}
38 toplevel $w
39 wm title $w "Bitmap Demonstration"
40 wm iconname $w "bitmap"
41 positionWindow $w
42
43 label $w.msg -font $font -wraplength 4i -justify left -text "This window displays all of Tk's built-in bitmaps, along with the names you can use for them in Tcl scripts."
44 pack $w.msg -side top
45
46 frame $w.buttons
47 pack $w.buttons -side bottom -fill x -pady 2m
48 button $w.buttons.dismiss -text Dismiss -command "destroy $w"
49 button $w.buttons.code -text "See Code" -command "showCode $w"
50 pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
51
52 frame $w.frame
53 bitmapRow $w.frame.0 error gray12 gray25 gray50 gray75
54 bitmapRow $w.frame.1 hourglass info question questhead warning
55 pack $w.frame -side top -expand yes -fill both