https://github.com/anthony-bernaert/ctk-sidebar
A sidebar navigation control for CustomTkinter
https://github.com/anthony-bernaert/ctk-sidebar
customtkinter gui modern-ui python python-ui sidebar sidebar-menu sidebar-navigation tkinter tkinter-gui ui user-interface
Last synced: about 6 hours ago
JSON representation
A sidebar navigation control for CustomTkinter
- Host: GitHub
- URL: https://github.com/anthony-bernaert/ctk-sidebar
- Owner: anthony-bernaert
- License: mit
- Created: 2025-10-04T10:37:35.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-10-18T21:20:17.000Z (6 months ago)
- Last Synced: 2026-01-03T04:20:22.979Z (3 months ago)
- Topics: customtkinter, gui, modern-ui, python, python-ui, sidebar, sidebar-menu, sidebar-navigation, tkinter, tkinter-gui, ui, user-interface
- Language: Python
- Homepage:
- Size: 81.1 KB
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sidebar Control for CustomTkinter
This is a custom widget that adds a sidebar to your CustomTkinter app and handles navigation.

## 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:
```python
import customtkinter
from ctksidebar import CTkSidebarNavigation
```
Instantiate a `CTkSidebarNavigation` component on your app's toplevel and get a reference to the sidebar:
```python
app = customtkinter.CTk()
app.geometry("640x480")
nav = CTkSidebarNavigation(master=app)
nav.pack(fill="both", expand=True)
side = nav.sidebar
```
Add a header:
```python
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:
```python
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()` as the master:
```python
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:
```python
nav.set("home")
app.mainloop()
```
# Documentation
See the [documentation](docs/DOCUMENTATION.md) page for a detailed description of this component.
See the [examples](examples/) folder for the demo applications shown in the screenshots above.