CTkMenuBar icon indicating copy to clipboard operation
CTkMenuBar copied to clipboard

in-menu checkboxes

Open SomeoneUnknownForReal opened this issue 1 year ago • 1 comments

When you have an option in a dropdown you could add a checkbox to set a value to either true or false.

SomeoneUnknownForReal avatar Dec 20 '24 18:12 SomeoneUnknownForReal

You can actually add checkboxes to the CTkMenuBar. Here's a simple code example:

from CTkMenuBar import CTkMenuBar, CustomDropdownMenu
import customtkinter as ctk

root = ctk.CTk()
root.geometry("400x400")

menubar = CTkMenuBar(root)

checkbox_menu = menubar.add_cascade("Checkboxes menu")
checkbox_dropdown = CustomDropdownMenu(widget=checkbox_menu)

checkbox_dropdown.add_option(option="Option 1")
checkbox_dropdown.add_option(option="Option 2")
checkbox_dropdown.add_option(option="Option 3")
checkbox_dropdown.add_option(option="Option 4")
checkbox_dropdown.add_option(option="Option 5")

checkbox_1 = ctk.CTkCheckBox(checkbox_dropdown, text="Checkbox 1")
checkbox_1.pack(padx=10, pady=10)

checkbox_2 = ctk.CTkCheckBox(checkbox_dropdown, text="Checkbox 2")
checkbox_2.pack(padx=10, pady=10)

checkbox_3 = ctk.CTkCheckBox(checkbox_dropdown, text="Checkbox 3")
checkbox_3.pack(padx=10, pady=10)

radiobutton = ctk.CTkRadioButton(checkbox_dropdown, text="RadioButton")
radiobutton.pack(padx=10, pady=10)

root.mainloop()

This is what came out of it:

Image

limafresh avatar Mar 18 '25 16:03 limafresh