|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
# Programa que pega o output do graficos.el e plota na tela
# (find-angg "elisp/graficos.el")
# (eev "wish ~/elisp/plot.tcl &")
# (start-process "plot" nil "wish" "plot.tcl")
# (start-process "plot" nil "c:/FundComp/bin/tclkit.exe" "plot.tcl")
canvas .c -width 500 -height 350 -relief sunken -borderwidth 2
frame .buttons
button .buttons.b1 -text {source 1.tcl} -command {source /tmp/1.tcl}
button .buttons.b2 -text {delete all} -command {.c delete all}
button .buttons.b3 -text {gera eps} -command {save_eps /tmp/1.eps}
pack .buttons.b1 .buttons.b2 .buttons.b3 -side left
pack .c -expand yes -fill both -side top
pack .c .buttons
set radius 2 ;# para pontos
set arrowstyle {-arrow last -width 2 -arrowshape {6 7 2} -smooth 1}
proc blackify {} {
.c itemconfigure all -fill black
}
proc save_eps {psfile} {
foreach {xl yu xr yd} [.c bbox all] {}
.c postscript \
-x $xl -y $yu -width [expr $xr-$xl] -height [expr $yd-$yu] \
-pageanchor nw -file $psfile
}
proc limpa {} {
.c delete all
}
proc ponto {x y args} {
global radius
eval .c create oval [expr $x-$radius] [expr $y-$radius] \
[expr $x+$radius] [expr $y+$radius] -fill black
}
proc seta {x1 y1 x2 y2} {
eval .c create line $x1 $y1 $x2 $y2 \
{-arrow last -width 2 -arrowshape {6 7 2} -smooth 1}
}
proc segmento {x1 y1 x2 y2} {
eval .c create line $x1 $y1 $x2 $y2 -width 1.5
}
proc segmento_eixo {x1 y1 x2 y2} {
eval .c create line $x1 $y1 $x2 $y2 -width 1
}
.c create line 100 100 110 120
.c create line 110 120 140 120
ponto 250 200
seta 100 50 200 60
segmento 100 120 200 120
# (eev "wish ~/elisp/plot.tcl &")