Skip to main content

Sidebar Control for CustomTkinter

GitHub last commit GitHub License GitHub Release

This is a custom widget that adds a sidebar to your CustomTkinter app and handles navigation.

CTkSidebar on Windows CTkSidebar on macOS

Features

  • Modern look
  • Handles navigation: each menu item gets a separate view
  • Easy to configure
  • Customizable styles
  • Supports submenus (tree structure)

Installation

Get the latest version from PyPI:

pip install ctk-sidebar

Getting started

Import required modules:

import customtkinter
from ctksidebar import CTkSidebarNavigation

Instantiate a CTkSidebarNavigation component on your app's toplevel and get a reference to the sidebar:

app = customtkinter.CTk()
app.geometry("640x480")

nav = CTkSidebarNavigation(master=app) 
nav.pack(fill="both", expand=True)
side = nav.sidebar

Add a header:

header = customtkinter.CTkLabel(side, text="My App", font=customtkinter.CTkFont(size=20, weight="bold"), fg_color="transparent", anchor="center", height=70)
side.add_frame(header)

Add some menu items:

side.add_item(id="home", text="Dashboard")
side.add_item(id="orders", text="Orders")
side.add_item(id="customers", text="Customers")

Populate the view of each menu item by using nav.view(<your_id>) as the master:

home_view = customtkinter.CTkLabel(nav.view("home"), text="Home", font=customtkinter.CTkFont(size=20, weight="bold"), fg_color="transparent")
home_view.grid(row=0, column=0, sticky="nsew", padx=20, pady=20)

orders_view = customtkinter.CTkLabel(nav.view("orders"), text="Orders", font=customtkinter.CTkFont(size=20, weight="bold"), fg_color="transparent")
orders_view.grid(row=0, column=0, sticky="nsew", padx=20, pady=20)

customers_view = customtkinter.CTkLabel(nav.view("customers"), text="Customers", font=customtkinter.CTkFont(size=20, weight="bold"), fg_color="transparent")
customers_view.grid(row=0, column=0, sticky="nsew", padx=20, pady=20)

Finally, set the startup view and launch the application:

nav.set("home")
app.mainloop()

Documentation

See the documentation page for a detailed description of this component.

See the examples folder for the demo applications shown in the screenshots above.

Metadata

Release files for ctk-sidebar 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ctk-sidebar 0.2.4
File Size Uploaded
ctk_sidebar-0.2.4.tar.gz 10.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ctk-sidebar 0.2.4
File Interpreter ABI Platform
ctk_sidebar-0.2.4-py3-none-any.whl Python 3 none any Details

Total release size: 23.1 kB

Release files / ctk_sidebar-0.2.4.tar.gz

Download URL ctk_sidebar-0.2.4.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
663f84bddbdf9174706af19de5968eaf985718e5570f8977a555792a12a3205d
BLAKE2b-256 checksum
How to use checksums
647a1878ea8bb8efe9d0592f6f6372cc317895dc0b16555b09b7e43b32ff1986
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / ctk_sidebar-0.2.4-py3-none-any.whl

Download URL ctk_sidebar-0.2.4-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca37a39afa59712b93172239b54260382ab1289940bad320870840e14193d5ce
BLAKE2b-256 checksum
How to use checksums
5db729be18cc4b17604f9fa5ed5c9169a746aecc5c3f2a283d641d8f6380f0a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.2.4 This release

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page