In many tkinter
examples available out there, you may see things like:
canvas.create_text(x, y, font=('Helvetica', 12), text='foo')
However, this may not work when run in your computer (the result would completely ignore the font parameter). Aparently, the font
parameter is ignored if there is any incorrect value in it.
In order to check if the font family is valid, how can I list all available in my system?
This question has been answered fully, but it's useful for me to be able to see what every font looks like so that I'm sure of which one I would like to use. In the interest of saving someone else from reinventing the wheel, I'll post my code here. As above, each font family is shown in a scrolling window. The difference is that each font in this code is printed in the font itself.
from tkinter import *
from tkinter import font
root = Tk()
root.title('Font Families')
fonts=list(font.families())
fonts.sort()
def populate(frame):
'''Put in the fonts'''
listnumber = 1
for item in fonts:
label = "listlabel" + str(listnumber)
label = Label(frame,text=item,font=(item, 16)).pack()
listnumber += 1
def onFrameConfigure(canvas):
'''Reset the scroll region to encompass the inner frame'''
canvas.configure(scrollregion=canvas.bbox("all"))
canvas = Canvas(root, borderwidth=0, background="#ffffff")
frame = Frame(canvas, background="#ffffff")
vsb = Scrollbar(root, orient="vertical", command=canvas.yview)
canvas.configure(yscrollcommand=vsb.set)
vsb.pack(side="right", fill="y")
canvas.pack(side="left", fill="both", expand=True)
canvas.create_window((4,4), window=frame, anchor="nw")
frame.bind("<Configure>", lambda event, canvas=canvas: onFrameConfigure(canvas))
populate(frame)
root.mainloop()
I hope this helps somebody.
All The fonts Of Tkinter are:
System
Terminal
Fixedsys
Modern
Roman
Script
Courier
MS Serif
MS Sans Serif
Small Fonts
Bell Gothic Std Black
Bell Gothic Std Light
Eccentric Std
Stencil Std
Tekton Pro
Tekton Pro Cond
Tekton Pro Ext
Trajan Pro
Rosewood Std Regular
Prestige Elite Std
Poplar Std
Orator Std
OCR A Std
Nueva Std Cond
Minion Pro SmBd
Minion Pro Med
Minion Pro Cond
Mesquite Std
Lithos Pro Regular
Kozuka Mincho Pro R
@Kozuka Mincho Pro R
Kozuka Mincho Pro M
@Kozuka Mincho Pro M
Kozuka Mincho Pro L
@Kozuka Mincho Pro L
Kozuka Mincho Pro H
@Kozuka Mincho Pro H
Kozuka Mincho Pro EL
@Kozuka Mincho Pro EL
Kozuka Mincho Pro B
@Kozuka Mincho Pro B
Kozuka Gothic Pro R
@Kozuka Gothic Pro R
Kozuka Gothic Pro M
@Kozuka Gothic Pro M
Kozuka Gothic Pro L
@Kozuka Gothic Pro L
Kozuka Gothic Pro H
@Kozuka Gothic Pro H
Kozuka Gothic Pro EL
@Kozuka Gothic Pro EL
Kozuka Gothic Pro B
@Kozuka Gothic Pro B
Hobo Std
Giddyup Std
Cooper Std Black
Charlemagne Std
Chaparral Pro
Brush Script Std
Blackoak Std
Birch Std
Adobe Garamond Pro
Adobe Garamond Pro Bold
Adobe Kaiti Std R
@Adobe Kaiti Std R
Adobe Heiti Std R
@Adobe Heiti Std R
Adobe Fangsong Std R
@Adobe Fangsong Std R
Adobe Caslon Pro
Adobe Caslon Pro Bold
Adobe Arabic
Adobe Devanagari
Adobe Hebrew
Adobe Ming Std L
@Adobe Ming Std L
Adobe Myungjo Std M
@Adobe Myungjo Std M
Adobe Song Std L
@Adobe Song Std L
Kozuka Gothic Pr6N B
@Kozuka Gothic Pr6N B
Kozuka Gothic Pr6N EL
@Kozuka Gothic Pr6N EL
Kozuka Gothic Pr6N H
@Kozuka Gothic Pr6N H
Kozuka Gothic Pr6N L
@Kozuka Gothic Pr6N L
Kozuka Gothic Pr6N M
@Kozuka Gothic Pr6N M
Kozuka Gothic Pr6N R
@Kozuka Gothic Pr6N R
Kozuka Mincho Pr6N B
@Kozuka Mincho Pr6N B
Kozuka Mincho Pr6N EL
@Kozuka Mincho Pr6N EL
Kozuka Mincho Pr6N H
@Kozuka Mincho Pr6N H
Kozuka Mincho Pr6N L
@Kozuka Mincho Pr6N L
Kozuka Mincho Pr6N M
@Kozuka Mincho Pr6N M
Kozuka Mincho Pr6N R
@Kozuka Mincho Pr6N R
Letter Gothic Std
Minion Pro
Myriad Hebrew
Myriad Pro
Myriad Pro Cond
Myriad Pro Light
Rosewood Std Fill
Marlett
Arial
Arabic Transparent
Arial Baltic
Arial CE
Arial CYR
Arial Greek
Arial TUR
Batang
@Batang
BatangChe
@BatangChe
Gungsuh
@Gungsuh
GungsuhChe
@GungsuhChe
Courier New
Courier New Baltic
Courier New CE
Courier New CYR
Courier New Greek
Courier New TUR
DaunPenh
DokChampa
Estrangelo Edessa
Euphemia
Gautami
Vani
Gulim
@Gulim
GulimChe
@GulimChe
Dotum
@Dotum
DotumChe
@DotumChe
Impact
Iskoola Pota
Kalinga
Kartika
Khmer UI
Lao UI
Latha
Lucida Console
Malgun Gothic
@Malgun Gothic
Mangal
Meiryo
@Meiryo
Meiryo UI
@Meiryo UI
Microsoft Himalaya
Microsoft JhengHei
@Microsoft JhengHei
Microsoft YaHei
@Microsoft YaHei
MingLiU
@MingLiU
PMingLiU
@PMingLiU
MingLiU_HKSCS
@MingLiU_HKSCS
MingLiU-ExtB
@MingLiU-ExtB
PMingLiU-ExtB
@PMingLiU-ExtB
MingLiU_HKSCS-ExtB
@MingLiU_HKSCS-ExtB
Mongolian Baiti
MS Gothic
@MS Gothic
MS PGothic
@MS PGothic
MS UI Gothic
@MS UI Gothic
MS Mincho
@MS Mincho
MS PMincho
@MS PMincho
MV Boli
Microsoft New Tai Lue
Nyala
Microsoft PhagsPa
Plantagenet Cherokee
Raavi
Segoe Script
Segoe UI
Segoe UI Semibold
Segoe UI Light
Segoe UI Symbol
Shruti
SimSun
@SimSun
NSimSun
@NSimSun
SimSun-ExtB
@SimSun-ExtB
Sylfaen
Microsoft Tai Le
Times New Roman
Times New Roman Baltic
Times New Roman CE
Times New Roman CYR
Times New Roman Greek
Times New Roman TUR
Tunga
Vrinda
Shonar Bangla
Microsoft Yi Baiti
Tahoma
Microsoft Sans Serif
Angsana New
Aparajita
Cordia New
Ebrima
Gisha
Kokila
Leelawadee
Microsoft Uighur
MoolBoran
Symbol
Utsaah
Vijaya
Wingdings
Andalus
Arabic Typesetting
Simplified Arabic
Simplified Arabic Fixed
Sakkal Majalla
Traditional Arabic
Aharoni
David
FrankRuehl
Levenim MT
Miriam
Miriam Fixed
Narkisim
Rod
FangSong
@FangSong
SimHei
@SimHei
KaiTi
@KaiTi
AngsanaUPC
Browallia New
BrowalliaUPC
CordiaUPC
DilleniaUPC
EucrosiaUPC
FreesiaUPC
IrisUPC
JasmineUPC
KodchiangUPC
LilyUPC
DFKai-SB
@DFKai-SB
Lucida Sans Unicode
Arial Black
Calibri
Cambria
Cambria Math
Candara
Comic Sans MS
Consolas
Constantia
Corbel
Franklin Gothic Medium
Gabriola
Georgia
Palatino Linotype
Segoe Print
Trebuchet MS
Verdana
Webdings
Haettenschweiler
MS Outlook
Book Antiqua
Century Gothic
Bookshelf Symbol 7
MS Reference Sans Serif
MS Reference Specialty
Bradley Hand ITC
Freestyle Script
French Script MT
Juice ITC
Kristen ITC
Lucida Handwriting
Mistral
Papyrus
Pristina
Tempus Sans ITC
Garamond
Monotype Corsiva
Agency FB
Arial Rounded MT Bold
Blackadder ITC
Bodoni MT
Bodoni MT Black
Bodoni MT Condensed
Bookman Old Style
Calisto MT
Castellar
Century Schoolbook
Copperplate Gothic Bold
Copperplate Gothic Light
Curlz MT
Edwardian Script ITC
Elephant
Engravers MT
Eras Bold ITC
Eras Demi ITC
Eras Light ITC
Eras Medium ITC
Felix Titling
Forte
Franklin Gothic Book
Franklin Gothic Demi
Franklin Gothic Demi Cond
Franklin Gothic Heavy
Franklin Gothic Medium Cond
Gigi
Gill Sans MT
Gill Sans MT Condensed
Gill Sans Ultra Bold
Gill Sans Ultra Bold Condensed
Gill Sans MT Ext Condensed Bold
Gloucester MT Extra Condensed
Goudy Old Style
Goudy Stout
Imprint MT Shadow
Lucida Sans
Lucida Sans Typewriter
Maiandra GD
OCR A Extended
Palace Script MT
Perpetua
Perpetua Titling MT
Rage Italic
Rockwell
Rockwell Condensed
Rockwell Extra Bold
Script MT Bold
Tw Cen MT
Tw Cen MT Condensed
Tw Cen MT Condensed Extra Bold
Algerian
Baskerville Old Face
Bauhaus 93
Bell MT
Berlin Sans FB
Berlin Sans FB Demi
Bernard MT Condensed
Bodoni MT Poster Compressed
Britannic Bold
Broadway
Brush Script MT
Californian FB
Centaur
Chiller
Colonna MT
Cooper Black
Footlight MT Light
Harlow Solid Italic
Harrington
High Tower Text
Jokerman
Kunstler Script
Lucida Bright
Lucida Calligraphy
Lucida Fax
Magneto
Matura MT Script Capitals
Modern No. 20
Niagara Engraved
Niagara Solid
Old English Text MT
Onyx
Parchment
Playbill
Poor Richard
Ravie
Informal Roman
Showcard Gothic
Snap ITC
Stencil
Viner Hand ITC
Vivaldi
Vladimir Script
Wide Latin
Century
Wingdings 2
Wingdings 3
Arial Unicode MS
@Arial Unicode MS
Arial Narrow
Rupee Foradian
Rupee
DevLys 010
Calibri Light
Monoton
Ubuntu Medium
Ubuntu
Ubuntu Light
Yatra One
HelvLight
Lato
Great Vibes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With