Search code examples
pythonfontstkinter

Truly custom font in Tkinter


I am making an interface in Tkinter and I need to have custom fonts. Not just, say, Helvetica at a certain size or whatever, but fonts other than what would normally be available on any given platform. This would be something that would be kept with the program as an image file or (preferably) Truetype font file or similar. I don't want to have to install the desired fonts on every machine that is going to use the program, I just want to carry them around with the program in the same directory.

The tkFont module looks like it ought to do something like this, but I can't see where it would take a filename for a font not normally accessible to the system running the program. Thanks in advance for your help.


Solution

  • I found this discussion where they cover how to use a line of text as an image and use PIL to place it into the window. That might be a solution.

    I could not find a way to use tkFont to import a bundled font in the tkFont man page.