CTkMenuBar Documentation

repository·main·Indexed 41 days ago

https://github.com/akascape/ctkmenubar

A modern menu bar widget library for customtkinter. It provides the CTkMenuBar class for standard menu bars, the CTkTitleMenu class for Windows-specific title bar menus, and the CustomDropdownMenu class for managing dropdown content, options, and submenus.

Tokens
417
Snippets
4
Records
5
Agent score
50%

What's inside CTkMenuBar

  1. Use the CTkTitleMenu widget (Windows only)

    main

    The CTkTitleMenu class adds a menu bar directly into the window's title bar. Note: This is only supported on Windows OS.

    from CTkMenuBar import *
    ...
    menu = CTkTitleMenu(master=root)
    button = menu.add_cascade("Menu")
  2. Use the CTkMenuBar widget

    main

    The CTkMenuBar class creates a modern menu bar that can be placed within a frame or at the top of a window. Use .add_cascade() to add menu buttons to the bar.

    from CTkMenuBar import *
    ...
    menu = CTkMenuBar(master=root)
    button = menu.add_cascade("Menu")
  3. Configure CustomDropdownMenu options and submenus

    main

    The CustomDropdownMenu is the underlying class used by both CTkMenuBar and CTkTitleMenu to handle the actual dropdown content. You can add options, separators, and nested submenus to a cascade button.

    from CTkMenuBar import *
    ...
    dropdown = CustomDropdownMenu(widget=button)
    dropdown.add_option(option="value") 
    dropdown.add_separator() 
    submenu = dropdown.add_submenu("submenu") 
    submenu.add_option(option="value")