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 |
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
ctklistbox-1.4.tar.gz
(6.3 kB
view details)
Built Distribution
File details
Details for the file ctklistbox-1.4.tar.gz
.
File metadata
- Download URL: ctklistbox-1.4.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91a3bd29b50456f025affc9f3a4b9e4385f7090e84e6faa5f57c362854f62ff0 |
|
MD5 | 9303d6de5a8fdd6b0b3b9496b14f841b |
|
BLAKE2b-256 | 3021ffce4b337f6f93eccb542b53e286e7d4a6faf0c9d5002ba03ef9e27d6e3d |
File details
Details for the file CTkListbox-1.4-py3-none-any.whl
.
File metadata
- Download URL: CTkListbox-1.4-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67053a94898e1dc4733c52102ec82e3b356a925eae5ca12d910377c32270995c |
|
MD5 | 9f6945fc7e6d05c03b584420bbc8a01c |
|
BLAKE2b-256 | c4c113a055ece69f5d89b045de6f3f36dccc23f6ce28f1657baf1bdc789e0d13 |