Customtkinter Listbox widget (with typing)
Project description
CTkListbox
This is a listbox widget for customtkinter, works just like the tkinter listbox.
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
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 :)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ctk_listbox_typed-1.5.0.tar.gz
.
File metadata
- Download URL: ctk_listbox_typed-1.5.0.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 435e54108302549e6e75f226754bab5701d8550687848075adf75b2cf4a7e15d |
|
MD5 | 7c7711cc01188f32efa5f43195e38589 |
|
BLAKE2b-256 | a3150a889ad8bcb616fab2fe32a8e6b5fab3f0d81f7e5a547b1a1e58fb19943f |
File details
Details for the file ctk_listbox_typed-1.5.0-py3-none-any.whl
.
File metadata
- Download URL: ctk_listbox_typed-1.5.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0479fdee1cd073515e579273fa05cd7714c293a83a727b7b0dcb1f0ffc85d98c |
|
MD5 | e70db97c3182565f2878ce59ba75339d |
|
BLAKE2b-256 | 1386401fbd81fae8548c059ba81e278a94700d2a70334311b5da44c6824e1e06 |