1

how do I get a list of the names of the available font in Tkinter?

The only fonts that I tried and worked were 'Courier' and 'Helvetica', and I tried using other fonts but it returned the same default fonts.

# this works
button = tk.Button(self.subframe, text="quit", command=master.destroy,
                        highlightbackground='black', font='Helvectica 18')

# this does not work (the text remains the font)
button = tk.Button(self.subframe, text="quit", command=master.destroy,
                        highlightbackground='black', font='Roboto 18')

(font used in the second example)

so I don't know which fonts are available or not, and it would be helpful if I can get a list of the fonts.

coder_not_found
  • 202
  • 2
  • 13
  • 2
    Does this answer your question?: https://stackoverflow.com/questions/39614027/list-available-font-families-in-tkinter/47415907 – Jacob Lee Mar 20 '21 at 04:41

1 Answers1

4

You can do like this

from tkinter import Tk, font
root = Tk()
print(font.families())