[Tkinter-discuss] Canvas() to Image() fonts
Michael Lange
klappnase at web.de
Fri Jul 28 13:10:37 EDT 2023
Hi,
On Fri, 28 Jul 2023 09:08:11 -0600
Bob Greschke <bob at passcal.nmt.edu> wrote:
> Hi!
>
> I'm plotting some stuff to a Canvas() (second-by-second signal-to-noise
> values for GPS satellites) and using something like
>
>
>
> in the program to get the font to use for text labels and stuff on the
> canvas.
>
> I can't figure out how to get the same font for the an Image (so I can
> duplicate the Canvas and save it as a png, of course). Without
> specifying anything the text used on the image looks something like
> Courier.
>
do you use Canvas.postscript() to export the canvas contents to an image?
If yes, the problem is probably that Tk and postscript disagree about the
exact spelling of the font name and so postscript falls back to some
default font.
(As a side note:
PROGPropFont = Font(font = Entry()["font"])
seems a bit over-complicated to me, simply doing
PROGPropFont = Font(name = "TkDefaultFont", exists = True)
should give you the same result. scnr :) )
Have a nice day,
Michael
More information about the Tkinter-discuss
mailing list