Skip to main content

Pygame menu - 3.4.0

Menu for pygame, simple, lightweight and easy to use


Pablo Pizarro
(ppizarror)
Python library that can create a simple menu for pygame application: - Scroll support - Widgets: buttons, images, text input, selectors - Multiple themes - Sound support

Changes

This version introduces a lot of changes from v3.3.2: Error fixes: Fixed widget resizing #232. (@arpruss) Fixed column calculation #233. (@arpruss) Fixed menu centering if the vertical widget offset is not zero, closes #230. Fixed submenu recursion while adding buttons to Menu #241. Fixed callable assertion. Fix scroll area surface size computation with different thickness scrollbars. Fixed edge cases in Menu get_selected_widget() method. Fixed draw exceptions in LeftArrowSelection and RightArrowSelection. Fixed exception while retrieving height of widget selection If it is None. Fixed submenu race if Menu is removed from button while using update_callback Button widget method. Fixed MenuBar widget back box status on certain conditions. Fixed widget selection in different edge cases (visibility, removal, unselectable). Fixed widget _font_render_string method if the font was not defined. New methods: Added widget padding, closes #229. New widget methods hide() and show #237. Image widget now can be created directly from a BaseImage object. BaseImage new param load_from_file. BaseImage new methods copy(), apply_image_function(func), to_bw() and pick_channels(channels). BaseImage transforms methods now returns the object reference for nested calls. Added scrollarea_outer_margin to themes. Added back_count to add_button Menu method. Added margin_id parameter in add_vertical_margin Menu method. Now VMargin accepts ID. New Menu method add_generic_widget for adding generic widgets to the menu. Widget attributes now accepts margin as a list. New Menu method select_widget(widget) that sets widget as selected. New Menu method get_widgets() which returns the widgets as a tuple. New Menu method in_submenu(menu) for detecting submenus. New Widget method change_id(id). New Widget method update_font(style) for changing the style using previous styles. New Image widget methods get_image() and set_image(image). Other changes: Added support for pygame v1.9.3. (@arpruss) Added example with OOP style, closes #228. Improve widget access, closes #237. Improve documentation, module testing, and several typos. Added font cache for performance improvement. Improve menu centering in different circumstances. Widgets return True if render changed. Changes that may break compatibility: Fixed Selector value in get_value() method. Now the entire tuple is returned instead of [0] item ff217d7. Removed onchange parameter of Button widget. Removed onchange parameter of ScrollBar widget. Menu _check_id_duplicated method now returns IndexError instead of ValueError. Menu get_selected_widget() method not returns None is no widget is selected instead of a ValueError exception. THEME_GREEN scrollbar thickness was established to 20px (previous were 14px). Adding recursive Menus now throws a ValueError exception. Widget get_selection_effect now returns a _NullSelection object instead of None if it is not stablished.

Links

Home Page
https://pygame-menu.readthedocs.io
Source
https://github.com/ppizarror/pygame-menu
Windows
https://github.com/ppizarror/pygame-menu
Mac
https://github.com/ppizarror/pygame-menu
Github repo
https://github.com/ppizarror/pygame-menu

Releases

Pygame menu 1.5 — 20 Jun, 2017

Pygame menu 1.6 — 20 Jul, 2017

Pygame menu 1.71 — 19 Nov, 2017

Pygame menu 1.72 — 29 Jan, 2018

Pygame menu 1.9 — 8 Apr, 2018

Pygame menu 1.93 — 8 Jun, 2018

Pygame menu 1.95 — 28 Sep, 2018

Pygame menu v1.96.1 — 13 Jun, 2019

Pygame menu 2.0.4 — 16 Aug, 2019

Pygame menu 2.0.1 — 31 Jul, 2019

Pygame menu 2.0.3 — 8 Aug, 2019

Pygame menu 2.1.2 — 18 Jan, 2020

Pygame menu 2.1.0 — 4 Jan, 2020

Pygame menu 3.0.0 — 3 May, 2020

Pygame menu 3.0.1 — 15 May, 2020

Pygame menu 3.0.3 — 19 May, 2020

Pygame menu 3.0.3.1 — 21 May, 2020

Pygame menu 3.1.2 — 22 Jun, 2020

Pygame menu 3.1.0 — 12 Jun, 2020

Pygame menu 3.1.0.1 — 17 Jun, 2020

Pygame menu 3.1.3 — 9 Jul, 2020

Pygame menu 3.1.5 — 30 Sep, 2020

Pygame menu 3.2.0 — 20 Oct, 2020

Pygame menu 3.3.0 — 29 Oct, 2020

Pygame menu 3.3.2 — 28 Nov, 2020

Pygame menu 3.4.0 — 3 Jan, 2021

Pygame menu 3.4.2 — 5 Jan, 2021

Pygame menu 3.5.1 — 14 Jan, 2021

Pygame menu 3.5.6 — 9 Feb, 2021

Pygame.org account Comments

  • tom 2017-07-24 18:55:18.044132

    This is impressive!!

    Pablo Pizarro 2017-11-19 16:31:08.752559

    thanks :), any feedback is welcome
  • Marcus Bell 2017-12-01 00:43:02.257072

    Looks good. I can't figure out how to close the menu though. (Only esc key works for this, but I want to use another key)

    Pablo Pizarro 2018-01-29 03:28:59.902971

    you can use a 'function' or pygamemenu event like PYGAME_MENU_CLOSE

    Tiago Lajas 2019-05-15 19:52:39.744571

    Idk why but I can't get that function to work.
  • Ales 2018-02-02 12:10:16.054344

    Perfect job! One question: when rise menu.enable() for main menu is not impacted required aplha %. Every time is menu apear with 100% opaque. When I use only draw method it's transparent, but menu is not functional (do not catch events, when is disable problably). Please advice - How can I run single transparent menu started from my python code. example.py starting transparent from main menu and this working. thanx Ales

    Pablo Pizarro 2018-04-11 11:44:07.540341

    that was already fixed, greetings!
  • Pablo Pizarro 2020-05-03 21:22:44.765888

    New version 3, added multiple widgets, image support, scrolling, new doc website https://pygame-menu.readthedocs.io
  • Slava 2020-10-26 20:02:45.493664

    Thank you for your work!