-
Notifications
You must be signed in to change notification settings - Fork 0
/
font.py
35 lines (27 loc) · 1.04 KB
/
font.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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)
listnumber += 1
if not 'Noto' in item: # workaround linux render problem
label = Label(frame,text=F'openList - {item}',font=(item, 16)).pack()
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()