| 1 |
#!../src/bltwish |
| 2 |
|
| 3 |
set blt_library ../library |
| 4 |
package require BLT |
| 5 |
set blt_library ../library |
| 6 |
set auto_path [linsert $auto_path 0 ../library] |
| 7 |
|
| 8 |
# -------------------------------------------------------------------------- |
| 9 |
# Starting with Tcl 8.x, the BLT commands are stored in their own |
| 10 |
# namespace called "blt". The idea is to prevent name clashes with |
| 11 |
# Tcl commands and variables from other packages, such as a "table" |
| 12 |
# command in two different packages. |
| 13 |
# |
| 14 |
# You can access the BLT commands in a couple of ways. You can prefix |
| 15 |
# all the BLT commands with the namespace qualifier "blt::" |
| 16 |
# |
| 17 |
# blt::graph .g |
| 18 |
# blt::table . .g -resize both |
| 19 |
# |
| 20 |
# or you can import all the command into the global namespace. |
| 21 |
# |
| 22 |
# namespace import blt::* |
| 23 |
# graph .g |
| 24 |
# table . .g -resize both |
| 25 |
# |
| 26 |
# -------------------------------------------------------------------------- |
| 27 |
|
| 28 |
if { $tcl_version >= 8.0 } { |
| 29 |
namespace import blt::* |
| 30 |
namespace import -force blt::tile::* |
| 31 |
} |
| 32 |
|
| 33 |
source scripts/demo.tcl |
| 34 |
|
| 35 |
image create photo bgTexture -file ./images/buckskin.gif |
| 36 |
|
| 37 |
option add *Graph.Tile bgTexture |
| 38 |
option add *Label.Tile bgTexture |
| 39 |
option add *Frame.Tile bgTexture |
| 40 |
option add *Htext.Tile bgTexture |
| 41 |
option add *TileOffset 0 |
| 42 |
option add *HighlightThickness 0 |
| 43 |
option add *Element.ScaleSymbols no |
| 44 |
option add *Element.Smooth linear |
| 45 |
option add *activeLine.Color yellow4 |
| 46 |
option add *activeLine.Fill yellow |
| 47 |
option add *activeLine.LineWidth 0 |
| 48 |
option add *Element.Pixels 3 |
| 49 |
option add *Graph.halo 7i |
| 50 |
|
| 51 |
set visual [winfo screenvisual .] |
| 52 |
if { $visual != "staticgray" } { |
| 53 |
option add *print.background yellow |
| 54 |
option add *quit.background red |
| 55 |
} |
| 56 |
|
| 57 |
proc FormatLabel { w value } { |
| 58 |
return $value |
| 59 |
} |
| 60 |
|
| 61 |
set graph .graph |
| 62 |
|
| 63 |
set length 250000 |
| 64 |
graph $graph -title "Scatter Plot\n$length points" |
| 65 |
$graph xaxis configure \ |
| 66 |
-loose no \ |
| 67 |
-title "X Axis Label" |
| 68 |
$graph yaxis configure \ |
| 69 |
-title "Y Axis Label" |
| 70 |
$graph legend configure \ |
| 71 |
-activerelief sunken \ |
| 72 |
-background "" |
| 73 |
|
| 74 |
$graph element create line3 -symbol square -color green4 -fill green2 \ |
| 75 |
-linewidth 0 -outlinewidth 1 -pixels 4 |
| 76 |
table . .graph 0,0 -fill both |
| 77 |
update |
| 78 |
|
| 79 |
vector create x($length) y($length) |
| 80 |
x expr random(x) |
| 81 |
y expr random(y) |
| 82 |
x sort y |
| 83 |
$graph element configure line3 -x x -y y |
| 84 |
|
| 85 |
wm min . 0 0 |
| 86 |
|
| 87 |
Blt_ZoomStack $graph |
| 88 |
Blt_Crosshairs $graph |
| 89 |
Blt_ActiveLegend $graph |
| 90 |
Blt_ClosestPoint $graph |
| 91 |
|
| 92 |
busy hold $graph |
| 93 |
update |
| 94 |
busy release $graph |
| 95 |
|