🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

CTkMenuBar

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

CTkMenuBar

Customtkinter Menu Widget

0.8
PyPI
Maintainers
1

CTkMenuBar

Modern menu bar widget library for customtkinter.

Features

  • Custom dropdown menus
  • Add menu in top of title bar
  • Classic and modern menubar with full customisability
  • Add commands and submenus

Installation

pip install CTkMenuBar

GitHub repo size

Menu Types

  • CTkMenuBar

menubar

Usage

from CTkMenuBar import *
...
menu = CTkMenuBar(master=root)
menu.add_cascade("Menu")
...

Methods

  • .add_cascade(text, ctk_button_args...): add new menu button in the menu bar
  • .configure(*frame_kwargs)

Arguments

ParameterDescription
masterdefine the master widget, can be root or frame
bg_colorset the bg color of the menu bar
heightset height of the menu bar
widthset width of the menu bar buttons
padxset internal padding between menu bar buttons
padyset internal padding in top and bottom of menu bar
postcommandadd a command before spawing the dropdown
*other frame parametersother ctk frame parameters can also be passed
  • CTkTitleMenu

This title menu is only supported in windows OS!

titlebar

Usage

from CTkMenuBar import *
...
menu = CTkTitleMenu(master=root)
menu.add_cascade("Menu")
...

Methods

  • .add_cascade(text, ctk_button_kwargs...): add new menu button in the menu bar

Arguments

ParameterDescription
masterdefine the master window, can be root or toplevel only
bg_colorset the bg color of the menu bar
title_bar_colorset color to the header (only works with windows 11), RGB order: 0x00rrggbb
widthset width of the menu bar buttons
padxset internal padding between menu bar buttons
x_offsetset the x distance from the header
y_offsetset the y distance from the header
postcommandadd a command before spawing the dropdown
*other frame parametersother ctk frame parameters can also be passed

CustomDropdownMenu

This is the common dropdown menu class which is used by both ctkmenubar and ctktitlemenu.

Usage

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") 
...

Methods

  • .add_option(option, command): add option to the dropdown and attach the command
  • .add_separator(): add a separator line between the options
  • .add_submenu(submenu_name): add a submenu as option
  • **.configure(**args): change dropdown menu options

Arguments

ParameterDescription
widgetattach the dropdown to the cascade widget
masteroptional, change the spawn window if required
bg_colorset the bg color of the dropdown
fg_colorset the option button fg color
text_colorset the text color
hover_colorset hover color of the option button
separator_colorchange the separator line color
fontchange the font of the text
widthset width of the dropdown
heightset height of the dropdown
padxset padding in x for the dropdown frame
padyset padding in y for the dropdown frame
*other frame parametersother ctk frame parameters can also be passed

Credits goes to LucianoSaldivia for providing this dropdown menu class.

Keywords

customtkinter

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts