You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pygame_menu/menu.py
+35-5
Original file line number
Diff line number
Diff line change
@@ -98,6 +98,7 @@ class Menu(Base):
98
98
:param position: Position on x-axis and y-axis. If the value is only 2 elements, the position is relative to the window width (thus, values must be 0-100%); else, the third element defines if the position is relative or not. If ``(x, y, False)`` the values of ``(x, y)`` are in px
99
99
:param rows: Number of rows of each column, if there's only 1 column ``None`` can be used for no-limit. Also, a tuple can be provided for defining different number of rows for each column, for example ``rows=10`` (each column can have a maximum 10 widgets), or ``rows=[2, 3, 5]`` (first column has 2 widgets, second 3, and third 5)
100
100
:param screen_dimension: List/Tuple representing the dimensions the Menu should reference for sizing/positioning (width, height), if ``None`` pygame is queried for the display mode. This value defines the ``window_size`` of the Menu
101
+
:param surface: The surface that contains the Menu. By default the Menu always considers that it is drawn on a surface that uses all window width/height. However, if a sub-surface is used the ``surface`` value will be used instead to retrieve the offset. Also, if ``surface`` is provided the menu can be drawn without providing a surface object while calling ``Menu.draw()``
101
102
:param theme: Menu theme
102
103
:param touchscreen: Enable/disable touch action inside the Menu. Only available on pygame 2
103
104
:param touchscreen_motion_selection: Select widgets using touchscreen motion. If ``True`` menu draws a ``focus`` on the selected widget
@@ -158,6 +159,8 @@ class Menu(Base):
158
159
_sound: 'Sound'
159
160
_stats: '_MenuStats'
160
161
_submenus: Dict['Menu', List['Widget']]
162
+
_surface: Optional['pygame.Surface'] # The surface that contains the menu
163
+
_surface_last: Optional['pygame.Surface'] # The last surface used to draw the menu
This method should not be used along :py:meth:`pygame_menu.menu.Menu.get_current`,
2473
+
for example, ``menu.get_current().update(...)``.
2474
+
2475
+
:return: Return the offset of the last surface used. If ``surface`` param was provided within Menu constructor that offset will be used instead, else, the returned value will be the last surface used to draw the Menu. Else, ``(0, 0)`` will be returned
Copy file name to clipboardExpand all lines: pygame_menu/widgets/core/widget.py
+4-1
Original file line number
Diff line number
Diff line change
@@ -1537,7 +1537,7 @@ def get_rect(
1537
1537
:param inflate: Inflate rect on x-axis and y-axis (x, y) in px
1538
1538
:param apply_padding: Apply widget padding
1539
1539
:param use_transformed_padding: Use scaled padding if the widget is scaled
1540
-
:param to_real_position: Transform the widget rect to real coordinates (if the Widget change the position if scrollbars move offsets). Used by events
1540
+
:param to_real_position: Transform the widget rect to real coordinates (if the Widget change the position if scrollbars move offsets) within the window. Used by events
1541
1541
:param to_absolute_position: Transform the widget rect to absolute coordinates (if the Widget does not change the position if scrollbars move offsets). Used by events
1542
1542
:param render: Force widget rendering
1543
1543
:param real_position_visible: Return only the visible width/height if ``to_real_position=True``
@@ -1566,6 +1566,9 @@ def get_rect(
1566
1566
'real and absolute positions cannot be True at the same time'
0 commit comments