File size: 1,959 Bytes
ef99749
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
#	$Id: CmpImg.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.

# This file demonstrates the use of the compound images: it uses compound
# images to display a text string together with a pixmap inside
# buttons
#
proc RunSample {w} {

    set img0 [tix getimage network]
    set img1 [tix getimage harddisk]

    button $w.hdd -padx 4 -pady 1 -width 120
    button $w.net -padx 4 -pady 1 -width 120

    # Create the first image: we create a line, then put a string,
    # a space and a image into this line, from left to right.
    # The result: we have a one-line image that consists of three
    # individual items
    #
    set hdd_img [image create compound -window $w.hdd]
    $hdd_img add line
    $hdd_img add text -text "Hard Disk" -underline 0
    $hdd_img add space -width 7
    $hdd_img add image -image $img1
 
    # Put this image into the first button
    #
    $w.hdd config -image $hdd_img

    # Create the second compound image. Very similar to what we did above
    #
    set net_img [image create compound -window $w.net]
    $net_img add line
    $net_img add text -text "Network" -underline 0
    $net_img add space -width 7
    $net_img add image -image $img0

    $w.net config -image $net_img

    # The button to close the window
    #

    button $w.clo -pady 1 -text Close -command "destroy $w"

    pack $w.hdd $w.net $w.clo -side left -padx 10 -pady 10 -fill y -expand yes
}

if {![info exists tix_demo_running]} {
    wm withdraw .
    set w .demo
    toplevel $w; wm transient $w ""
    RunSample $w
    bind $w <Destroy> exit
}