The TabView Widget – Tkinter CustomTkinter 12

In this video I’ll talk all about the TabView Widget for CustomTkinter and Python.

Tabs are a great way to break up the layout of a GUI.

In this video I’ll show you how to create them in CustomTkinter and also how to customize the look and feel of them.

Python Code: ctk_tabs.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 Tabs')
root.iconbitmap('images/codemy.ico')
root.geometry('700x300')

def clicker():
	my_button.configure(text="You Clicked The Tab Button")

# Create Tabview
my_tab = customtkinter.CTkTabview(root,
	width=600,
	height=250,
	corner_radius=10,
	fg_color="silver",
	segmented_button_fg_color="red",
	segmented_button_selected_color="green",
	segmented_button_selected_hover_color="pink",
	segmented_button_unselected_hover_color="purple",
	segmented_button_unselected_color="yellow",
	text_color="red",
	state="normal",
	command=clicker,
		)
my_tab.pack(pady=10)

# Create tabs
tab_1 = my_tab.add("Tab 1")
tab_2 = my_tab.add("Tab 2")

# Put stuff in tabs
my_button = customtkinter.CTkButton(tab_1, text="Click Me!")
my_button.pack(pady=40)



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

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