简体   繁体   中英

Tkinter shows only the basic 'fixed' font is available. How to load other fonts to Tkinter?

I am asking tkinter to tell me the different fonts available with

import tkinter.font as font
print(font.families())

It returns ('fixed',) meaning that apparently only a single, default font is available. So when I try to set the font type, size or weight of eg a Text widget this has no effect.

However, in my CENTOS installation there are a few fonts installed, eg the liberation font I would like to use under /usr/share/fonts/liberation.

How can I make this font available to tkinter? Apparently it doesn't find the fonts under /usr/share/fonts/.

Thanks

Just for future reference: I didn't progress at all in this matter. There is a similar topic here

Make Anaconda's tkinter aware of system fonts or install new fonts for Anaconda

however I was unable to make xfontsel work as it is described there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM