def print_to_file(self, filename=None):
"""
Print the contents of this C{CanvasFrame} to a postscript
file. If no filename is given, then prompt the user for one.
@param filename: The name of the file to print the tree to.
@type filename: C{string}
@rtype: C{None}
"""
if filename is None:
from tkFileDialog import asksaveasfilename
ftypes = [('Postscript files', '.ps'),
('All files', '*')]
filename = asksaveasfilename(filetypes=ftypes,
defaultextension='.ps')
if not filename: return
(x0, y0, w, h) = self.scrollregion()
self._canvas.postscript(file=filename, x=x0, y=y0,
width=w+2, height=h+2,
pagewidth=w+2, # points = 1/72 inch
pageheight=h+2, # points = 1/72 inch
pagex=0, pagey=0)
评论列表
文章目录