Skip to main content

Customtkinter Menu Widget

Project description

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

Parameter Description
master define the master widget, can be root or frame
bg_color set the bg color of the menu bar
height set height of the menu bar
width set width of the menu bar buttons
padx set internal padding between menu bar buttons
pady set internal padding in top and bottom of menu bar
postcommand add a command before spawing the dropdown
*other frame parameters other 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

Parameter Description
master define the master window, can be root or toplevel only
bg_color set the bg color of the menu bar
title_bar_color set color to the header (only works with windows 11), RGB order: 0x00rrggbb
width set width of the menu bar buttons
padx set internal padding between menu bar buttons
x_offset set the x distance from the header
y_offset set the y distance from the header
postcommand add a command before spawing the dropdown
*other frame parameters other 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

Parameter Description
widget attach the dropdown to the cascade widget
master optional, change the spawn window if required
bg_color set the bg color of the dropdown
fg_color set the option button fg color
text_color set the text color
hover_color set hover color of the option button
separator_color change the separator line color
font change the font of the text
width set width of the dropdown
height set height of the dropdown
padx set padding in x for the dropdown frame
pady set padding in y for the dropdown frame
*other frame parameters other ctk frame parameters can also be passed

Credits goes to LucianoSaldivia for providing this dropdown menu class.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ctkmenubar-0.8.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

CTkMenuBar-0.8-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file ctkmenubar-0.8.tar.gz.

File metadata

  • Download URL: ctkmenubar-0.8.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.0

File hashes

Hashes for ctkmenubar-0.8.tar.gz
Algorithm Hash digest
SHA256 08ddc63caf2ec4ad45bbbf8a974ef78e891c6821b57eed8d4f57417bcc79fdd8
MD5 1440ecd89d7a9b203f770270b4503fff
BLAKE2b-256 ef1b3df22027211fcdd9b5b89e5c167730bf00ab57fe2c722ed961fb3204b33d

See more details on using hashes here.

File details

Details for the file CTkMenuBar-0.8-py3-none-any.whl.

File metadata

  • Download URL: CTkMenuBar-0.8-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.0

File hashes

Hashes for CTkMenuBar-0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 f2ad71bc545d90ad468c93045be7e0c5b0e2090e3ccb59a67b8d019197a603a1
MD5 737e327f032e93e937f85dab7217f30c
BLAKE2b-256 fc5dee4623a8c00b109b7fad4e427ebef27ac1918a56e4f6910d3af8ba015f88

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page