In this video we’ll learn how to use Object Oriented Programming with CustomTkinter and Python.

Class Based Programming, as opposed to the Functional Based Programming we usually do, is something a lot of people are interested in.

In this video I’ll show you how to use Class Based Object Oriented Programming with CustomTkinter and Tkinter in general.
Python Code: ctk_object_oriented.py
(Github Code)

from tkinter import *
import customtkinter

# Set the theme and color options
customtkinter.set_appearance_mode("dark")  # Modes: system (default), light, dark
customtkinter.set_default_color_theme("dark-blue")  # Themes: blue (default), dark-blue, green

class App(customtkinter.CTk):
	def __init__(self):
		super().__init__()
		#root = customtkinter.CTk()

		self.title('Tkinter.com - Object Oriented CustomTkinter')
		self.iconbitmap('images/codemy.ico')
		self.geometry('700x450')


		

		# Text Box
		self.my_text = customtkinter.CTkTextbox(self, width=600, height=300)
		self.my_text.pack(pady=20)

		self.my_button = customtkinter.CTkButton(self, text="Clear Box", command=self.clear)
		self.my_button.pack(pady=20)

	def clear(self):
		self.my_text.delete('0.0', END)

# Define app and Create our app's mainloop
app = App()
app.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...