I am trying to save a Tkinter canvas to a postscript file.
This script creates an image on screen and it creates a postscript file. But
the image in the file seems to be trashed.
I'm working on OSX, but similar problems in a larger program failed (same way)
in unix.
JL
------------
#DwV_plot000A.py
#drive postscript bug
from Tkinter import *
#Put some stuff on the canvas (from Lutz' Introduction):
canvas=Canvas(width=300, height=300, bg='white') #0,0 is top left corner
canvas.pack(expand=YES, fill=BOTH) #increase down, right
canvas.create_line(100,100,200,200) #fromX, fromY, toX, toY
canvas.create_line(100,200,200,300) # draw shapes
for i in range(1, 20, 2):
canvas.create_line(0, i, 50, i)
canvas.create_oval(10,10,200,200, width=2, fill='blue')
widget=Label(canvas, text='Spam', fg='white', bg='black')
#Save it to a postscript file.
# (It saves something, but the format appears to be in error.
canvas.postscript(file='plot001.ps',colormode='color')
mainloop()
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor