Add attribute font_path to the class tkinter.font.Font

Feature Request

I think it would be usefull if the class tkinter.font.Font would contain the path to the font.

With it, we can use many software like fonttools to obtain more information about the font.
It is usefull because the tkinter.font.Font class is very limited.

In which case this feature is usefull?

  1. When you know a font name and need more information (ex: with glyph the font contain, information in the NamingTable, etc…), but you doesnt know it’s location on the drive.
  2. When you wanna get all the font with the same characteristic. It would be possible like that:
from fontTools import ttLib
from tkinter import font as tkFont, Tk


for family_name in tkFont.families():
    a_tk_font = tkFont.Font(name=family_name)
    font_path = a_tk_font.actual("path")

    # Example with FontTools
    font = ttLib.TTFont(font_path)
    # Do X operation with FontTools

Why it should the the job of tkinter?

tkinter already do the hard jobs to communicate with the os to get some font information.

Like you can see on this issue, it is not simple to get the path of an font: [MNT]: findSystemFonts - Use system API instead to look into folder · Issue #24001 · matplotlib/matplotlib · GitHub

So, in brief, tkinter would now not only be used for the rendering, but also a way to get installed font path on the drive.

Have a nice day

The “path” option is not supported. The only valid font options are “family”, “size”, “weight”, “slant”, “underline”, and “overstrike”.

If you want to add support of new option, ask the Tcl/Tk code developers.

If you want to add support of new option, ask the Tcl/Tk code developers.

Where can I do that?
I thought the feature request need to be approved in the topic idea.

Tcl/Tk is a separate project (and a completely separate language). Python simply imports the 3rd party Tcl/Tk code. To contact the Tcl/Tk developers, you should probably start from

Ok. I have sent them a message.