-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
The docs don't show how to output to postscript or to svg.
Example:
#!/usr/bin/env wish9
package require tkpath
proc main {} {
const BASENAME /tmp/tkpath_out
const WIDTH 640
const HEIGHT 480
font create Courier -family Courier -size 18
font create Helvetica -family Helvetica -size 18
font create Times -family Times -size 18
array set fontmap {
Courier {Courier-Roman 18}
Helvetica {Helvetica-Roman 18}
Times {Times-Roman 18}
}
tkp::canvas .canv -width $WIDTH -height $HEIGHT
pack .canv
.canv create ellipse 150 150 -rx 130 -ry 130 -fill #00FF00 -stroke #FF0000 -strokewidth 15
.canv create ellipse 270 270 -rx 110 -ry 110 -fill #FFFF00 -stroke #FF0000 -strokewidth 15
.canv create ellipse 370 370 -rx 70 -ry 70 -fill #0000FF -stroke #FF0000 -strokewidth 15
.canv create ptext 400 150 -fontsize 24 -fontfamily Courier -text "0O1lQ Courier " -textanchor w
.canv create ptext 400 170 -fontsize 24 -fontfamily Helvetica -text "0O1lQ Helvetica " -textanchor w
.canv create ptext 400 190 -fontsize 24 -fontfamily Times -text "0O1lQ Times " -textanchor w
update
.canv postscript -file $BASENAME.ps -colormode color -fontmap fontmap
exec ps2pdf $BASENAME.ps $BASENAME.pdf
file delete $BASENAME.ps
exec {*}[auto_execok okular] $BASENAME.pdf &
bind . <Escape> exit
}
mainIf you comment out from the postscript line to the second exec line it shows the canvas correctly. But with the lines uncommented (as above) it just produces an error:
Error in startup script: gsave
(generating Postscript for item 1)
invoked from within
".canv postscript -file $BASENAME.ps -colormode color -fontmap fontmap"
(procedure "main" line 22)
invoked from within
"main"
(file "/tmp/test.tcl" line 33)
I'm using Debian Linux.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels