def print_to_file(self, filename=None):
"""
Print the contents of this ``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: str
:rtype: None
"""
if filename is None:
from tkinter.filedialog 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)
util.py 文件源码
python
阅读 18
收藏 0
点赞 0
评论 0
评论列表
文章目录