Skip to main content

A modern sidebar navigation control for CustomTkinter

Project description

Sidebar Control for CustomTkinter

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

CTkSidebar on macOS CTkSidebar on Windows

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ctk_sidebar-0.2.3.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ctk_sidebar-0.2.3-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file ctk_sidebar-0.2.3.tar.gz.

File metadata

  • Download URL: ctk_sidebar-0.2.3.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for ctk_sidebar-0.2.3.tar.gz
Algorithm Hash digest
SHA256 0bb09cb0e3bd345557dc560a7719925b0ab2253323e736e477f249e8f3ae8a7d
MD5 84c14b1833a4afd34dd095a3e05a85f4
BLAKE2b-256 a21c33ba63dab703266bcd65ef81d084e5cdac08e07ad9d2062d3da968e019db

See more details on using hashes here.

File details

Details for the file ctk_sidebar-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: ctk_sidebar-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for ctk_sidebar-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c8cbb4194c04816fbf78d8fce7d81f61bc3a8ecb050d9c2513e08757ab2dabd5
MD5 55fe10641a92bc3668b1f283042d1831
BLAKE2b-256 7e6c0371140088700758857f8deded1e975c351fa38d5f50015ef0d6a666b495

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page