tk_fonts.py

#===================================================================
# fonts
#===================================================================

import sys

def RunningPython3():
    if sys.version_info.major == 3:
        print('Running Python3')
        return True
    print('Running python2')
    return False

p3 = RunningPython3()

if p3:
    import tkinter as tk
    from tkinter import font as tkf 
else:
    import Tkinter as tk
    import tkFont as tkf

root = tk.Tk()

cfont6   = tkf.Font(family="Courier", size=6)
cfont8   = tkf.Font(family="Courier", size=8)
cfont10  = tkf.Font(family="Courier", size=10)
cfont12  = tkf.Font(family="Courier", size=12)
cfont14  = tkf.Font(family="Courier", size=14)
cfont16  = tkf.Font(family="Courier", size=16)
cfont18  = tkf.Font(family="Courier", size=18)
cfont20  = tkf.Font(family="Courier", size=20)
cfont6b  = tkf.Font(family="Courier", weight="bold", size=6)
cfont8b  = tkf.Font(family="Courier", weight="bold", size=8)
cfont10b = tkf.Font(family="Courier", weight="bold", size=10)
cfont12b = tkf.Font(family="Courier", weight="bold", size=12)
cfont14b = tkf.Font(family="Courier", weight="bold", size=14)
cfont16b = tkf.Font(family="Courier", weight="bold", size=16)
cfont18b = tkf.Font(family="Courier", weight="bold", size=18)
cfont20b = tkf.Font(family="Courier", weight="bold", size=20)

hfont6   = tkf.Font(family="Helvetica", size=6)
hfont8   = tkf.Font(family="Helvetica", size=8)
hfont10  = tkf.Font(family="Helvetica", size=10)
hfont12  = tkf.Font(family="Helvetica", size=12)
hfont14  = tkf.Font(family="Helvetica", size=14)
hfont16  = tkf.Font(family="Helvetica", size=16)
hfont18  = tkf.Font(family="Helvetica", size=18)
hfont20  = tkf.Font(family="Helvetica", size=20)
hfont6b  = tkf.Font(family="Helvetica", weight="bold", size=6)
hfont8b  = tkf.Font(family="Helvetica", weight="bold", size=8)
hfont10b = tkf.Font(family="Helvetica", weight="bold", size=10)
hfont12b = tkf.Font(family="Helvetica", weight="bold", size=12)
hfont14b = tkf.Font(family="Helvetica", weight="bold", size=14)
hfont16b = tkf.Font(family="Helvetica", weight="bold", size=16)
hfont18b = tkf.Font(family="Helvetica", weight="bold", size=18)
hfont20b = tkf.Font(family="Helvetica", weight="bold", size=20)

tfont6   = tkf.Font(family="Times", size=6)
tfont8   = tkf.Font(family="Times", size=8)
tfont10  = tkf.Font(family="Times", size=10)
tfont12  = tkf.Font(family="Times", size=12)
tfont14  = tkf.Font(family="Times", size=14)
tfont16  = tkf.Font(family="Times", size=16)
tfont18  = tkf.Font(family="Times", size=18)
tfont20  = tkf.Font(family="Times", size=20)
tfont6b  = tkf.Font(family="Times", weight="bold", size=6)
tfont8b  = tkf.Font(family="Times", weight="bold", size=8)
tfont10b = tkf.Font(family="Times", weight="bold", size=10)
tfont12b = tkf.Font(family="Times", weight="bold", size=12)
tfont14b = tkf.Font(family="Times", weight="bold", size=14)
tfont16b = tkf.Font(family="Times", weight="bold", size=16)
tfont18b = tkf.Font(family="Times", weight="bold", size=18)
tfont20b = tkf.Font(family="Times", weight="bold", size=20)

wtfont = hfont10b       # window title font
bhfont = hfont10b       # block title font
btfont = hfont10b       # button font
lbfont = cfont14        # listbox font
bbfont = cfont12        # block body font
twfont = cfont12        # text window font

root.title('Families')

fonts = list(tkf.families())
fonts.sort()

display = tk.Listbox(root, font=lbfont)
display.pack(fill=tk.BOTH, expand=tk.YES, side=tk.LEFT)

scroll = tk.Scrollbar(root)
scroll.pack(side=tk.RIGHT, fill=tk.Y, expand=tk.NO)

scroll.configure(command=display.yview)
display.configure(yscrollcommand=scroll.set)

for item in fonts:
    display.insert(tk.END, item)

root.mainloop()