Added Text.fonts_installed_list - returns the fonts installed as reported by tkinter.

This commit is contained in:
PySimpleGUI 2022-01-23 06:39:46 -05:00
parent c5fae56754
commit 81599f643b
2 changed files with 35 additions and 9 deletions

View file

@ -1,17 +1,20 @@
#!/usr/bin/env python
import sys
import PySimpleGUI as sg
from tkinter import font
import tkinter
root = tkinter.Tk()
fonts = list(font.families())
fonts.sort()
root.destroy()
'''
Showing fonts in PSG / tk
Demo Font Previewer
Gets a list of the installed fonts according to tkinter.
Requires PySimpleGUI version 4.57.0 and newer (that's when sg.Text.fonts_installed_list was added)
Uses the Text element's class method to get the fonts reported by tkinter.
Copyright 2020, 2021, 2022 PySimpleGUI
'''
fonts = sg.Text.fonts_installed_list()
sg.theme('Black')
layout = [[sg.Text('My Text Element',