Skip to main content

CTkListbox

This is a listbox widget for customtkinter, works just like the tkinter listbox.

Screenshot

Installation

NOTE: This is a fork of the original CTkListbox library by Akascape, which fixes some bugs (that would otherwise cause the widget to be hardly usable), adds typing and a few other features.

pip install ctk_listbox

GitHub repo size

Usage

import customtkinter
from CTkListbox import *

def show_value(selected_option):
    print(selected_option)
    
root = customtkinter.CTk()

listbox = CTkListbox(root, command=show_value)
listbox.pack(fill="both", expand=True, padx=10, pady=10)

listbox.insert(0, "Option 0")
listbox.insert(1, "Option 1")
listbox.insert(2, "Option 2")
listbox.insert(3, "Option 3")
listbox.insert(4, "Option 4")
listbox.insert(5, "Option 5")
listbox.insert(6, "Option 6")
listbox.insert(7, "Option 7")
listbox.insert("END", "Option 8")

root.mainloop()

Arguments

Parameter Description
master parent widget
width optional, set width of the listbox
height optional, set height of the listbox
fg_color foreground color of the listbox
border_color border color of the listbox frame
border_width width of the border frame
text_color set the color of the option text
hover_color set hover color of the options
button_color set color of unselected buttons
highlight_color set the selected color of the option
font set font of the option text
command calls a command when a option is selected
multiple_selection select multiple options in the listbox, default=False
listvariable use a tkinter variable to change the listbox content
*other_parameters all other parameters of ctk_scrollable frame can be passed

Methods

  • .insert(index, option) add new option to the listbox
  • .get() get the selected option(s)
  • .delete(index) delete any option from the listbox. .delete("all") deletes all options
  • .size() get the size of the listbox
  • .activate(index) activate any option
  • .deactivate(index) deactivate any option
  • .curselection() returns indexes of selected options
  • .configure() change some parameters for the listbox.
  • .move_up(index)/.move_down(index) Reorder options in the listbox

Thanks for visiting! Hope it will help :)

Metadata

Release files for ctk-listbox-typed 1.5.0

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-listbox-typed 1.5.0
File Size Uploaded
ctk_listbox_typed-1.5.0.tar.gz 7.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ctk-listbox-typed 1.5.0
File Interpreter ABI Platform
ctk_listbox_typed-1.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.9 kB

Release files / ctk_listbox_typed-1.5.0.tar.gz

Download URL ctk_listbox_typed-1.5.0.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
435e54108302549e6e75f226754bab5701d8550687848075adf75b2cf4a7e15d
BLAKE2b-256 checksum
How to use checksums
a3150a889ad8bcb616fab2fe32a8e6b5fab3f0d81f7e5a547b1a1e58fb19943f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.1

Release files / ctk_listbox_typed-1.5.0-py3-none-any.whl

Download URL ctk_listbox_typed-1.5.0-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0479fdee1cd073515e579273fa05cd7714c293a83a727b7b0dcb1f0ffc85d98c
BLAKE2b-256 checksum
How to use checksums
1386401fbd81fae8548c059ba81e278a94700d2a70334311b5da44c6824e1e06
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.1

Release history Release notifications | RSS feed

This release

1.5.0 This release

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