Migration Guide - v3 to v4
pygame_menu v4
no longer python 2.7 to 3.5.VMargin
widget 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
smooth
by default, also rotation applies on checkpointed surface.Menu
add_button
,add_color_input
,add_image
,add_label
,add_selector
,add_text_input
,add_vertical_margin
andadd_generic_widget
were moved toWidgetManager
class.Menu
add_image
method parameterscale_smooth
is nowTrue
by default.Menu
clear
method now receivesreset
optional argument.Menu
mainloop
,update
anddraw
now raisesRuntimeError
if it’s disabled. This behaviour can be changed though Menu private property_runtime_errors
.Menu column/row positioning has changed, now
column_max_width
has 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_width
colorinput method tokwargs
.Removed
column_force_fit_text
fromMenu
constructor. Use Widgetset_max_width
orset_max_height
instead.Removed
dummy_function
frompygame_menu.utils
.Removed
events.DISABLE_CLOSE
, useNone
orevents.NONE
instead.Removed
Widget
methodsurface_needs_update()
. Now use methodforce_menu_surface_update
if needed.Renamed
ColorInput
constantsTYPE_HEX
,TYPE_RGB
,HEX_FORMAT_LOWER
,HEX_FORMAT_NONE
, andHEX_FORMAT_UPPER
, toCOLORINPUT_*
.Renamed
touchscreen_enabled
totouchscreen
inMenu
constructor.Renamed
Widget
method fromset_selected(selected=True)
toselect(status=True, update_menu=False)
.Renamed Menu constructor parameter
menu_position
toposition
.Renamed Selector
elements
toitems
.Renamed Selector
update_elements
toupdate_items
.Renamed Theme
menubar_close_button
totitle_close_button
.Renamed Theme
title_shadow_color
totitle_font_shadow_color
.Renamed Theme
title_shadow_offset
totitle_font_shadow_offset
.Renamed Theme
title_shadow_position` to ``title_font_shadow_position
.Renamed Theme
title_shadow
totitle_font_shadow
.Renamed Theme
widget_shadow_color
towidget_font_shadow_color
.Renamed Theme
widget_shadow_offset
towidget_font_shadow_offset
.Renamed Theme
widget_shadow_position` to ``widget_font_shadow_position
.Renamed Theme
widget_shadow
towidget_font_shadow
.Renamed Widget
_force_menu_surface_update
method toforce_menu_surface_update
.Renamed Widget
_force_menu_surface_update
method toforce_menu_surface_update
.Renamed Widget
expand_background_inflate_to_selection_effect
method tobackground_inflate_to_selection_effect
.Widget
selected
property is now private. Useis_selected()
to check selection status, andselect(...)
to modify it.Widget
shadow_offset
now cannot beNone
orfloat
, onlyint
allowed.Widget
sound
property is now private. Use.get_sound()
or.set_sound()
.Widget
visible
property is now private. Use.is_visible()
to check visibility status, and.show()
or.hide()
to modify it.Widget
VMargin
now inherits fromNoneWidget
.Widget properties
joystick_enabled
,mouse_enabled
,touchscreen_enabled
andsound
are now private.WidgetManager methods renamed
shadow
tofont_shadow
for each shadow-related optional arguments.Widgets now must define only
_draw
,draw()
is reserved to Widget core class only.