Debian Codegraph @

demos/graph3.tcl

raw
1 #!../src/bltwish
2
3 package require BLT
4 # --------------------------------------------------------------------------
5 # Starting with Tcl 8.x, the BLT commands are stored in their own
6 # namespace called "blt". The idea is to prevent name clashes with
7 # Tcl commands and variables from other packages, such as a "table"
8 # command in two different packages.
9 #
10 # You can access the BLT commands in a couple of ways. You can prefix
11 # all the BLT commands with the namespace qualifier "blt::"
12 #
13 # blt::graph .g
14 # blt::table . .g -resize both
15 #
16 # or you can import all the command into the global namespace.
17 #
18 # namespace import blt::*
19 # graph .g
20 # table . .g -resize both
21 #
22 # --------------------------------------------------------------------------
23 if { $tcl_version >= 8.0 } {
24 namespace import blt::*
25 namespace import -force blt::tile::*
26 }
27 source scripts/demo.tcl
28 source scripts/stipples.tcl
29
30 set visual [winfo screenvisual .]
31 if { $visual != "staticgray" && $visual != "grayscale" } {
32 option add *Button.Background red
33 option add *TextMarker.Foreground black
34 option add *TextMarker.Background yellow
35 option add *LineMarker.Foreground black
36 option add *LineMarker.Background yellow
37 option add *PolyMarker.Fill yellow2
38 option add *PolyMarker.Outline ""
39 option add *PolyMarker.Stipple fdiagonal1
40 option add *activeLine.Color red4
41 option add *activeLine.Fill red2
42 option add *Element.Color purple
43 }
44
45 image create photo bgTexture \
46 -file ./images/chalk.gif
47
48 option add *Tile bgTexture
49 option add *Button.Tile ""
50 option add *Text.font -*-times*-bold-r-*-*-18-*-*
51 option add *header.font -*-times*-medium-r-*-*-18-*-*
52 option add *footer.font -*-times*-medium-r-*-*-18-*-*
53 option add *HighlightThickness 0
54
55 set graph [graph .g]
56 source scripts/graph3.tcl
57
58
59
60 text .header \
61 -wrap word \
62 -width 0 \
63 -height 3
64
65 set text {
66 This is an example of a bitmap marker. Try zooming in on
67 a region by clicking the left button, moving the pointer,
68 and clicking again. Notice that the bitmap scales too.
69 To restore the last view, click on the right button.
70 }
71 regsub -all "\n" $text "" text
72 .header insert end "$text\n"
73 .header configure -state disabled
74
75 htext .footer -text {Hit the %%
76 set im [image create photo -file ./images/stopsign.gif]
77 button $htext(widget).quit -image $im -command { exit }
78 $htext(widget) append $htext(widget).quit
79 %% button when you've seen enough. %%
80 label $htext(widget).logo -bitmap BLT
81 $htext(widget) append $htext(widget).logo
82 %%}
83
84 table . \
85 .header 0,0 -fill x -padx 4 -pady 4\
86 $graph 1,0 -fill both \
87 .footer 2,0 -fill x -padx 4 -pady 4
88
89 table configure . r0 r2 -resize none
90
91 source scripts/ps.tcl
92
93 bind $graph <Shift-ButtonPress-1> {
94 MakePsLayout $graph
95 }
96
97 if 0 {
98 set printer [printer open [lindex [printer names] 0]]
99 after 2000 {
100 $graph print2 $printer
101 }
102 }
103 #after 2000 {
104 # PsDialog $graph
105 #}