This is very helpful to know regarding the list of all available fonts in Tkinter. The code given below is helpful to people who want to know about the Tkinter font families. the code given below is straightforward and it is understandable. Let us need to follow a few steps for this.
Get a list of all available fonts in Tkinter
First, here you need to follow the steps which are given below.
1)You need to import the Tkinter library.
import tkinter as tk
2)Next, import font submodule.
from tkinter import font
3)Create the main application window and try to print the list of all available fonts of the Tkinter.
4)Start the main event loop at last.
You will get the output finally.
#import tkinter library and assign alias 'tk' import tkinter as tk #import font submodule from tkinter import font #Create the main application window window = tk.Tk() #Get a list of all available fonts fonts = font.families() #Print the list of fonts print(fonts) #Start the main event loop window.mainloop()
OUTPUT:
olid Italic', 'Harrington', 'Haettenschweiler', 'High Tower Text', 'Imprint MT Shadow', 'Informal Roman', 'Blackadder ITC', 'Edwardian Script ITC', 'Kristen ITC', 'Jokerman', 'Juice ITC', 'Kunstler Script', 'Wide Latin', 'Lucida Bright', 'Lucida Calligraphy', 'Lucida Fax', 'Lucida Handwriting', 'Lucida Sans', 'Lucida Sans Typewriter', 'Magneto', 'Maiandra GD', 'Matura MT Script Capitals', 'Mistral', 'Modern No. 20', 'Monotype Corsiva', 'MT Extra', 'Niagara Engraved', 'Niagara Solid', 'OCR A Extended', 'Old English Text MT', 'Onyx', 'MS Outlook', 'Palace Script MT', 'Papyrus', 'Parchment', 'Perpetua', 'Perpetua Titling MT', 'Playbill', 'Poor Richard', 'Pristina', 'Rage Italic', 'Ravie', 'MS Reference Sans Serif', 'MS Reference Specialty', 'Rockwell Condensed', 'Rockwell', 'Rockwell Extra Bold', 'Script MT Bold', 'Showcard Gothic', 'Snap ITC', 'Stencil', 'Tw Cen MT', 'Tw Cen MT Condensed', 'Tw Cen MT Condensed Extra Bold', 'Tempus Sans ITC', 'Viner Hand ITC', 'Vivaldi', 'Vladimir Script', 'Wingdings 2', 'Wingdings 3', 'Cascadia Code ExtraLight', 'Cascadia Code Light', 'Cascadia Code SemiLight', 'Cascadia Code', 'Cascadia Code SemiBold', 'Cascadia Mono ExtraLight', 'Cascadia Mono Light', 'Cascadia Mono SemiLight', 'Cascadia Mono', 'Cascadia Mono SemiBold'