Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

tkinter canas can you use other fonts

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()
Comment

PREVIOUS NEXT
Code Example
Python :: python indentation 
Python :: pdf to string python 
Python :: select rows with multiple conditions pandas query 
Python :: from pandas to dictionary 
Python :: python how to inspect pyd for functions 
Python :: isolationforest estimators 
Python :: producer and consumer problem in python 
Python :: tic-tac toe in pygame 
Python :: stack program in python3 
Python :: #adding new str to set in python 
Python :: iterate through a list and print from index x to y using for loop python 
Python :: data type array 
Python :: python syntax errors 
Python :: get data from kaggle to colab 
Python :: List Comprehension generate a list 
Python :: count elements in list python 
Python :: python discord know message from bot 
Python :: while not command in python 
Python :: pandas read csv file 
Python :: df length 
Python :: how to turn on debug mode in flask 
Python :: how to delete record in django 
Python :: breadth first search 
Python :: abstarct class python 
Python :: python filter numbers from list 
Python :: how to multiply in python 
Python :: how to add a new element to a list in python 
Python :: what is index in list in python 
Python :: python tkinter button color 
Python :: python read from stdin pipe 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =