Customtkinter Listbox widget
Project description
CTkListbox
This is a listbox widget for customtkinter, works just like the tkinter listbox.
Installation
pip install CTkListbox
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 |
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 nwq option to the listbox
- .get() get the selected option(s)
- .delete(index) delete any option from the listbox
- .size() get the size of the listbox
- .activate(index) activate any option
- .deactivae(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
CTkListbox-0.10.tar.gz
(5.6 kB
view hashes)
Built Distribution
Close
Hashes for CTkListbox-0.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c1b046474386a0b999d2505f65a666b99fa92a82ec32796a411b57a570973d8 |
|
MD5 | dd0e7c71bf9cfa767ca209c629384c3b |
|
BLAKE2b-256 | 404a26fc990721ba61e935ca2f2db98685cbe1fb9af09a99ad9299aee27f94c5 |