-
Notifications
You must be signed in to change notification settings - Fork 1k
CTkComboBox
Tom Schimansky edited this page Jun 1, 2022
·
14 revisions
![Bildschirmfoto 2022-06-02 um 00 31 19](https://user-images.githubusercontent.com/66446067/171512626-2370c181-5442-432c-8f4b-9436e5923d50.png)
![Bildschirmfoto 2022-06-02 um 00 32 22](https://user-images.githubusercontent.com/66446067/171512634-d801f2c2-bab7-4ffe-ae03-b1377f5d0149.png)
Without variable:
def combobox_callback(choice):
print("combobox dropdown clicked:", choice)
combobox = customtkinter.CTkComboBox(master=app,
values=["option 1", "option 2"],
command=combobox_callback)
combobox.pack(padx=20, pady=10)
combobox.set("option 2") # set initial value
With variable:
combobox_var = customtkinter.StringVar(value="option 2")
def combobox_callback(choice):
print("combobox dropdown clicked:", choice)
combobox = customtkinter.CTkComboBox(master=app,
values=["option 1", "option 2"],
command=combobox_callback,
variable=combobox_var)
combobox.pack(padx=20, pady=10)
argument | value |
---|---|
master | root, tkinter.Frame or CTkFrame |
variable | StringVar to control or get the current text |
width | box width in px |
height | box height in px |
corner_radius | corner radius in px |
border_width | border width in px |
fg_color | foreground (inside) color, tuple: (light_color, dark_color) or single color |
bg_color | background color, tuple: (light_color, dark_color) or single color, default is None |
border_color | border color, tuple: (light_color, dark_color) or single color |
button_color | right button color, tuple: (light_color, dark_color) or single color |
button_hover_color | hover color, tuple: (light_color, dark_color) or single color |
text_color | text color, tuple: (light_color, dark_color) or single color |
text_color | text color, tuple: (light_color, dark_color) or single color |
text_color | text color, tuple: (light_color, dark_color) or single color |
text_color_disabled | text color when disabled, tuple: (light_color, dark_color) or single color |
text_font | button text font, tuple: (font_name, size) |
hover | enable/disable hover effect: True, False |
state | tkinter.NORMAL (standard) or tkinter.DISABLED (not clickable, darker color) |
command | function will be called when the checkbox is clicked |
variable | Tkinter variable to control or read checkbox state |
onvalue | string or int for variable in checked state |
offvalue | string or int for variable in unchecked state |
CustomTkinter by Tom Schimansky 2022
The Github Wiki is outdated, the new documentation can be found at: