In this video we’ll look at the Images widget/utility in CustomTkinter and Python.

The CTkImage utility lets you use images in easily scalable ways with Tkinter.

Resizing images is a hassle with regular Tkinter, but this utility/widget makes it super easy!

Python Code: ctk_images.py
(Github Code)

from tkinter import *
import customtkinter
from PIL import Image


customtkinter.set_appearance_mode("light")  # 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 Images')
root.iconbitmap('images/codemy.ico')
root.geometry('400x550')


my_image = customtkinter.CTkImage(light_image=Image.open('images/aspen1.png'),
	dark_image=Image.open('images/aspen1.png'),
	size=(180,250)) # WidthxHeight

my_label = customtkinter.CTkLabel(root, text="", image=my_image)
my_label.pack(pady=10)



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...