Widget Selection¶
Selection Effect¶
-
class
pygame_menu.widgets.core.
Selection
(margin_left, margin_right, margin_top, margin_bottom)[source]¶ Widget selection class.
Parameters: -
draw
(surface, widget)[source]¶ Draw the selection.
Parameters: - surface (
pygame.Surface
) – Surface to draw - widget (
pygame_menu.widgets.core.Widget
) – Widget object
Returns: None
- surface (
-
get_height
()[source]¶ Return the selection height (px) as sum of top and bottom margins.
Returns: Height in px Return type: int, float
-
get_margin
()[source]¶ Return the top, left, bottom and right margins of the selection.
Returns: Tuple of (top,left,bottom,right) margins in px Return type: tuple
-
get_width
()[source]¶ Return the selection width (px) as sum of left and right margins.
Returns: Width in px Return type: int, float
-
get_xy_margin
()[source]¶ Returns the x/y margins of the selection.
Returns: Tuple of (x,y) margins Return type: tuple
-
inflate
(rect)[source]¶ Grow or shrink the rectangle size according to margins.
Parameters: rect ( pygame.Rect
) – Rect objectReturns: Inflated rect Return type: pygame.Rect
-
Highlight Selection Effect¶
-
class
pygame_menu.widgets.
HighlightSelection
(border_width=1, margin_x=16, margin_y=8)[source]¶ Bases:
pygame_menu.widgets.core.selection.Selection
Widget selection highlight class.
Note
Widget background color may not reach the entire selection area
Parameters: -
draw
(surface, widget)[source]¶ Draw the selection.
Parameters: - surface (
pygame.Surface
) – Surface to draw - widget (
pygame_menu.widgets.core.Widget
) – Widget object
Returns: None
- surface (
-
Left Arrow Selection Effect¶
-
class
pygame_menu.widgets.
LeftArrowSelection
(arrow_size=(10, 15), arrow_right_margin=5, arrow_vertical_offset=0, blink_ms=0)[source]¶ Bases:
pygame_menu.widgets.selection.arrow_selection.ArrowSelection
Widget selection left arrow class. Creates an arrow to the left of the selected menu item.
Parameters: -
draw
(surface, widget)[source]¶ Draw the selection.
Parameters: - surface (
pygame.Surface
) – Surface to draw - widget (
pygame_menu.widgets.core.Widget
) – Widget object
Returns: None
- surface (
-
None Selection Effect¶
-
class
pygame_menu.widgets.
NoneSelection
[source]¶ Bases:
pygame_menu.widgets.core.selection.Selection
No selection effect.
-
draw
(surface, widget)[source]¶ Draw the selection.
Parameters: - surface (
pygame.Surface
) – Surface to draw - widget (
pygame_menu.widgets.core.Widget
) – Widget object
Returns: None
- surface (
-
Right Arrow Selection Effect¶
-
class
pygame_menu.widgets.
RightArrowSelection
(arrow_size=(10, 15), arrow_left_margin=3, arrow_vertical_offset=0, blink_ms=0)[source]¶ Bases:
pygame_menu.widgets.selection.arrow_selection.ArrowSelection
Widget selection right arrow class. Creates an arrow to the right of the selected menu item.
Parameters: -
draw
(surface, widget)[source]¶ Draw the selection.
Parameters: - surface (
pygame.Surface
) – Surface to draw - widget (
pygame_menu.widgets.core.Widget
) – Widget object
Returns: None
- surface (
-