如何在我的 PySimpleGUI 桌面应用程序中使用 Google 字体?

How can I use Google Fonts in my PySimpleGUI desktop application?

有没有办法在我的 PySimpleGUI 桌面应用程序中使用 Google 字体?或者是否有任何 Python 内置包可以在我的代码中使用 Google 字体?如果有,我如何用导入模块的 Google 字体替换 PySimpleGUI 中(按钮或文本)元素的字体?而且我还发现 PySimpleGUI 中有几种可用的字体(HelveticaCourierTimesArial...),但我想查看 PySimpleGUI 中可用字体的完整列表?

可用字体列表取决于您 运行 使用的 GUI 框架以及操作系统。

PySimpleGUI GitHub 上的演示程序区域中有一个名为 "Font Previewer" 的演示,它获取可用字体列表并进行预览。

它直接调用 tkinter 来获取字体列表,因为此时它不是 PySimpleGUI 中实现的功能。从来没有人要求过它。

这是演示中使用的代码,它获取字体列表并将其放入变量 fonts

from tkinter import font
import tkinter
root = tkinter.Tk()
fonts = list(font.families())
fonts.sort()
root.destroy()