File: toolbar

package info (click to toggle)
itcl3.0 3.0.1-3
  • links: PTS
  • area: main
  • in suites: potato
  • size: 10,124 kB
  • ctags: 3,519
  • sloc: tcl: 32,416; ansic: 12,683; sh: 3,911; makefile: 693; awk: 273; perl: 265
file content (50 lines) | stat: -rw-r--r-- 1,665 bytes parent folder | download | duplicates (14)
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
#!/bin/sh
# ----------------------------------------------------------------------
#  DEMO: toolbar in [incr Widgets]
# ----------------------------------------------------------------------
#\
exec itkwish -f "$0" ${1+"$@"}
package require -exact Iwidgets 2.2

# itkwish interprets the rest...
# ----------------------------------------------------------------------
label .status -textvariable statusVar -width 40 -anchor w
pack .status -side bottom

iwidgets::toolbar .tb -helpvariable statusVar -orient vertical
pack .tb -side left -anchor nw -padx 4 -pady 4

set imagedir [file join ${iwidgets::library} demos images]

.tb add button select \
    -helpstr "Select drawing elements" \
    -image [image create photo -file [file join $imagedir select.gif]] \
    -balloonstr "Selection tool" \
    -command {puts "tool: select"}

.tb add button magnify \
    -helpstr "Magnify drawing area" \
    -image [image create photo -file [file join $imagedir mag.gif]] \
    -balloonstr "Zoom tool" \
    -command {puts "tool: magnify"}

.tb add button ruler \
    -helpstr "Measure distances on drawing" \
    -image [image create photo -file [file join $imagedir ruler.gif]] \
    -balloonstr "Ruler tool" \
    -command {puts "tool: ruler"}

.tb add frame filler \
    -borderwidth 1 \
    -width 10 \
    -height 10

.tb add button poly \
    -helpstr "Draw a polygon" \
    -image [image create photo -file [file join $imagedir poly.gif]] \
    -balloonstr "Polygon tool" \
    -command {puts "tool: polygon"}

canvas .worksp -width 2i -height 3i \
    -borderwidth 2 -relief sunken -background white
pack .worksp -side right -expand yes -fill both -padx 4 -pady 4