Migration Guide - v3 to v4
pygame_menu v4no longer python 2.7 to 3.5.VMarginwidget now updates it’s height rather than modifying the margin.Added
__all__to module, then some usage cases importing with * may fail.All locals inner value have changed. If you used the value as-is you’ll get an error.
BaseImage applies
smoothby default, also rotation applies on checkpointed surface.Menu
add_button,add_color_input,add_image,add_label,add_selector,add_text_input,add_vertical_marginandadd_generic_widgetwere moved toWidgetManagerclass.Menu
add_imagemethod parameterscale_smoothis nowTrueby default.Menu
clearmethod now receivesresetoptional argument.Menu
mainloop,updateanddrawnow raisesRuntimeErrorif it’s disabled. This behaviour can be changed though Menu private property_runtime_errors.Menu column/row positioning has changed, now
column_max_widthhas a different behaviour. For setting the minimum width of columns usecolumn_min_width. Expect some minor changes to the global layout. Now is much more consistent.Menu constructor changed from
Menu(height, width, title, ...)toMenu(title, width, height, ...).Menu method
get_width()changes to``get_width(inner=False, widget=False)``.Moved
previsualization_widthcolorinput method tokwargs.Removed
column_force_fit_textfromMenuconstructor. Use Widgetset_max_widthorset_max_heightinstead.Removed
dummy_functionfrompygame_menu.utils.Removed
events.DISABLE_CLOSE, useNoneorevents.NONEinstead.Removed
Widgetmethodsurface_needs_update(). Now use methodforce_menu_surface_updateif needed.Renamed
ColorInputconstantsTYPE_HEX,TYPE_RGB,HEX_FORMAT_LOWER,HEX_FORMAT_NONE, andHEX_FORMAT_UPPER, toCOLORINPUT_*.Renamed
touchscreen_enabledtotouchscreeninMenuconstructor.Renamed
Widgetmethod fromset_selected(selected=True)toselect(status=True, update_menu=False).Renamed Menu constructor parameter
menu_positiontoposition.Renamed Selector
elementstoitems.Renamed Selector
update_elementstoupdate_items.Renamed Theme
menubar_close_buttontotitle_close_button.Renamed Theme
title_shadow_colortotitle_font_shadow_color.Renamed Theme
title_shadow_offsettotitle_font_shadow_offset.Renamed Theme
title_shadow_position` to ``title_font_shadow_position.Renamed Theme
title_shadowtotitle_font_shadow.Renamed Theme
widget_shadow_colortowidget_font_shadow_color.Renamed Theme
widget_shadow_offsettowidget_font_shadow_offset.Renamed Theme
widget_shadow_position` to ``widget_font_shadow_position.Renamed Theme
widget_shadowtowidget_font_shadow.Renamed Widget
_force_menu_surface_updatemethod toforce_menu_surface_update.Renamed Widget
_force_menu_surface_updatemethod toforce_menu_surface_update.Renamed Widget
expand_background_inflate_to_selection_effectmethod tobackground_inflate_to_selection_effect.Widget
selectedproperty is now private. Useis_selected()to check selection status, andselect(...)to modify it.Widget
shadow_offsetnow cannot beNoneorfloat, onlyintallowed.Widget
soundproperty is now private. Use.get_sound()or.set_sound().Widget
visibleproperty is now private. Use.is_visible()to check visibility status, and.show()or.hide()to modify it.Widget
VMarginnow inherits fromNoneWidget.Widget properties
joystick_enabled,mouse_enabled,touchscreen_enabledandsoundare now private.WidgetManager methods renamed
shadowtofont_shadowfor each shadow-related optional arguments.Widgets now must define only
_draw,draw()is reserved to Widget core class only.