Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_viewfonts.py
- from Tkinter import *
- import tkFont
- root = Tk()
- yscrollbar = Scrollbar(root)
- yscrollbar.pack(side=RIGHT, fill=Y)
- fonts=list(tkFont.families())
- fonts.sort()
- c = Canvas(root, bg='black')
- c.pack(expand=1, fill=BOTH)
- ta = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
- tb = 'abcdefghijklmnopqrstuvwxyz'
- tc = '''0123456789!"#$%&'()*+'''
- td = ''',-./:;<=>?@[\]^_`{|}~'''
- default_font = tkFont.Font(font='TkDefaultFont').configure()
- # {'family': 'Segoe UI', 'weight': 'normal', 'slant': 'roman', 'overstrike': 0, 'underline': 0, 'size': 9}
- def new_line(i):
- if i != len(fonts):
- thefont=fonts[i]
- ht=((i)*300)+20
- c.create_text(20,ht, text=thefont, font=default_font, fill='white', anchor='w')
- for ii,s in enumerate([ta,tb,tc,td,'','']):
- tt = (thefont,40)
- c.create_text(20,ht+((ii+1)*50), text=s, font=tt, fill='white', anchor='w')
- new_line(i+1)
- new_line(0)
- c.config(scrollregion=c.bbox(ALL))
- c.config(yscrollcommand=yscrollbar.set)
- yscrollbar.config(command=c.yview)
- root.geometry('1280x680+0+0')
- root.mainloop()
Add Comment
Please, Sign In to add comment