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.
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::"
14 # blt::table . .g -resize both
16 # or you can import all the command into the global namespace.
18 # namespace import blt::*
20 # table . .g -resize both
22 # --------------------------------------------------------------------------
23 if { $tcl_version >= 8.0 } {
24 namespace import blt::*
25 namespace import -force blt::tile::*
28 source scripts/demo.tcl
30 source scripts/stipples.tcl
32 if { ![string match "*gray*" [winfo screenvisual .]] } {
33 option add *Button.Background red
34 option add *TextMarker.Foreground black
35 option add *TextMarker.Background yellow
36 option add *LineMarker.Foreground black
37 option add *LineMarker.Background yellow
38 option add *PolyMarker.Fill yellow2
39 option add *PolyMarker.Outline ""
40 option add *PolyMarker.Stipple bdiagonal1
41 option add *activeLine.Color red4
42 option add *activeLine.Fill red2
43 option add *Element.Color purple
47 R0lGODlhEAANAMIAAAAAAH9/f///////AL+/vwAA/wAAAAAAACH5BAEAAAUALAAAAAAQAA0A
48 AAM8WBrM+rAEQWmIb5KxiWjNInCkV32AJHRlGQBgDA7vdN4vUa8tC78qlrCWmvRKsJTquHkp
52 R0lGODlhEAANAMIAAAAAAH9/f///////AL+/vwAA/wAAAAAAACH5BAEAAAUALAAAAAAQAA0A
53 AAM1WBrM+rAEMigJ8c3Kb3OSII6kGABhp1JnaK1VGwjwKwtvHqNzzd263M3H4n2OH1QBwGw6
56 set image [image create photo -format gif -data $data]
62 source scripts/graph2.tcl
64 $graph postscript configure \
70 $graph axis configure x \
74 $graph element configure line1 \
75 -areapattern solid -areaforeground green
77 $graph element configure line3 \
78 -areapattern @bitmaps/sharky.xbm \
80 -areabackground "" -areapattern solid
83 set fileName testImg.jpg
84 if { [file exists $fileName] } {
85 set image [image create photo]
86 winop image readjpeg $fileName $image
89 $graph marker create image -image $image \
90 -coords "-360.0 -1.0 360.0 1.0" \
99 bind $graph <Control-ButtonPress-3> { MakeSnapshot }
100 bind $graph <Shift-ButtonPress-3> {
101 %W postscript output demo2.ps
102 %W snap -format emf demo2.emf
106 proc MakeSnapshot {} {
109 set top ".snapshot[incr unique]"
110 set im [image create photo]
111 $graph snap $im 210 150
114 wm title $top "Snapshot \#$unique of \"[$graph cget -title]\""
115 label $top.lab -image $im
116 button $top.but -text "Dismiss" -command "DestroySnapshot $top"
118 table $top $top.but -pady 4
122 proc DestroySnapshot { win } {
123 set im [$win.lab cget -image]
130 if { $tcl_platform(platform) == "windows" } {
132 set name [lindex [blt::printer names] 0]
133 set printer {Lexmark Optra E310}
134 blt::printer open $printer
135 blt::printer getattrs $printer attrs
136 puts $attrs(Orientation)
137 set attrs(Orientation) Landscape
138 set attrs(DocumentName) "This is my print job"
139 blt::printer setattrs $printer attrs
140 blt::printer getattrs $printer attrs
141 puts $attrs(Orientation)
143 $graph print2 $printer
144 blt::printer close $printer
152 after 2000 {$graph snap -format emf CLIPBOARD}