[Tkinter-discuss] Canvas() to Image() fonts

Michael Lange klappnase at web.de
Sat Jul 29 16:52:17 EDT 2023


Hi Bob,

On Fri, 28 Jul 2023 13:00:10 -0600
Bob Greschke <bob at greschke.com> wrote:

> Hi Michael!
>
> I'm working up to Image.save("something.png"). The program will produce
> a picture for each of five different monitors each day, and then
> they'll end up on a web page, so a .png is desired. The program now
> draws the canvas, then uses an ImageGrab.grab() to make a picture of
> the Canvas. The problem, in Debian/X11/etc. is that you have to be
> logged in and looking at what is going on. If you try to run the
> image-making remotely (ssh -Y'ing), or using a cron job, everything
> works, but the pictures come out blank because there's no valid
> $DISPLAY. I'm trying to get it automated with the Image, however
> forcing me to look at the pictures and watch for anomalies in the
> signals each day is not a bad thing. :)

maybe you could use Canvas.postscript() and then convert the output to
png with psconvert, not sure if this helps with the missing $DISPLAY
though. Plus you might need to stick with a font whose spelling Tk and
postscript agree about (I think Arial would be my first guess here).

Have a nice day,

Michael


More information about the Tkinter-discuss mailing list