In this video we’ll look at the custom fonts widget in CustomTkinter and Python.

The Font widget allows you to update all sorts of things dealing with fonts.

The benefit of using the widget instead of just updating the font attribute in another widget, is that you can update the fonts at any time when you use a font widget.

You can’t do that otherwise.

Python Code: ctk_fonts.py
(Github Code)

from tkinter import *
import customtkinter

customtkinter.set_appearance_mode("dark")  # Modes: system (default), light, dark
customtkinter.set_default_color_theme("dark-blue")  # Themes: blue (default), dark-blue, green

#root = Tk()
root = customtkinter.CTk()

root.title('Tkinter.com - CustomTkinter Fonts')
root.iconbitmap('images/codemy.ico')
root.geometry('400x200')

def change():
	my_font.configure(underline=False, overstrike=False, size=22, slant="roman")

my_font = customtkinter.CTkFont(family="Helvetica", size=44, 
	weight="bold", slant="italic", underline=True, overstrike=True) #weight bold/normal, slant=italic/roman

my_label = customtkinter.CTkLabel(root, text="This is Text", font=my_font)
my_label.pack(pady=40)

my_button = customtkinter.CTkButton(root, text="Change Text", command=change)
my_button.pack()



root.mainloop()


John Elder

John is the CEO of Codemy.com where he teaches over 100,000 students how to code! He founded one of the Internet's earliest advertising networks and sold it to a publicly company at the height of the first dot com boom. After that he developed the award-winning Submission-Spider search engine submission software that's been used by over 3 million individuals, businesses, and governments in over 42 countries. He's written several Amazon #1 best selling books on coding, and runs a popular Youtube coding channel.

View all posts

Add comment

Your email address will not be published. Required fields are marked *

John Elder

John is the CEO of Codemy.com where he teaches over 100,000 students how to code! He founded one of the Internet's earliest advertising networks and sold it to a publicly company at the height of...