pygame-menu Logo
3.0.1

First steps

  • Creating menus
  • Adding widgets
  • Adding sounds
  • Creating themes
  • Gallery
  • Migration Guide - v2 to v3

Advanced usage

  • Package organization
  • Create a widget
  • Create a selection effect

Widgets API

  • Button
  • ColorInput
  • Image
  • Label
  • MenuBar
  • ScrollBar
  • Selector
  • TextInput
  • VMargin

About pygame-menu

  • License
  • Contributors
pygame-menu
  • Docs »
  • MenuBar
  • Edit on GitHub

MenuBar¶

class pygame_menu.widgets.MenuBar(label, width, background_color, back_box=False, mode=1000, onchange=None, onreturn=None, *args, **kwargs)[source]¶

Bases: pygame_menu.widgets.core.widget.Widget

MenuBar widget.

Parameters:
  • label (str) – Title of the Menu
  • width (int, float) – Width of the widget, generally width of the Menu
  • background_color (tuple, list) – Background color
  • back_box (bool) – Draw a back-box button on header
  • mode (int) – Mode of drawing the bar
  • onchange (callable, None) – Callback when changing the selector
  • onreturn (callable, None) – Callback when pressing return button
  • args (any) – Optional arguments for callbacks
  • kwargs (any) – Optional keyword-arguments for callbacks
draw(surface)[source]¶

Draw the widget shape.

Parameters:surface (pygame.Surface) – Surface to draw
Returns:None
get_title()[source]¶

Return the title of the Menu.

Returns:Menu title
Return type:str
set_title(title, offsetx=0, offsety=0)[source]¶

Set Menu title.

Parameters:
  • title (str) – Menu title
  • offsetx (int, float) – Offset x-position of title (px)
  • offsety (int, float) – Offset y-position of title (px)
Returns:

None

update(events)[source]¶

Update internal variable according to the given events list and fire the callbacks.

Parameters:events (list[pygame.event.Event]) – List of pygame events
Returns:True if updated
Return type:bool

© Copyright 2020, Pablo Pizarro R. @ppizarror Revision a2e1f9bd.

Built with Sphinx using a theme provided by Read the Docs.