[Tutor] How to get a Tkinter window to print a color copy of itself as a .pdf file?
Steven D'Aprano
steve at pearwood.info
Wed Apr 15 15:29:08 CEST 2015
On Wed, Apr 15, 2015 at 07:55:28AM -0500, boB Stepp wrote:
> Solaris 10, Python 2.4.4
>
> I have very little experience with issuing print commands using a Unix
> environment. Despite this, I wish to design a Tkinter window with a
> "Print" button, which, when clicked, would create a copy of the
> contents of the window as a .pdf file. GhostScript is available on my
> systems.
>
> I know that the Canvas container has the ability to print itself to a
> postscript file, but I do not want to use Canvas as my container
> object.
You will excuse me, I hope, but I'm afraid that comes across as rather
foolish:
"I want to hammer this nail into this piece of wood. I have a hammer,
but I don't want to use a hammer. I would prefer to use a saw, or
perhaps a paint brush. How can I do this?"
Why don't you want to use a Canvas? That sounds like it will solve your
problem. Use a Canvas as the container, give it a button, and have the
button send a message to the Canvas saying "Print yourself to PDF
file!"
If you explain why you don't wish to use a Canvas, perhaps we can
suggest a solution that doesn't involve trying to hammer nails with
paint brushes.
--
Steve
More information about the Tutor
mailing list