Skip to content

Commit cab84ca

Browse files
committed
Add column_span argument to all other BoxElement elements
1 parent c50c3c6 commit cab84ca

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/pygamepopup/components/button.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class Button(BoxElement):
4545
defaults to WHITE.
4646
complementary_text_lines (str): the other text lines that should be displayed in addition of
4747
the title.
48+
column_span (int): the number of columns the element should span, defaults to 1.
4849
4950
Attributes:
5051
callback (Callable): the reference to the function that should be call after a click.
@@ -69,8 +70,9 @@ def __init__(
6970
font_hover: pygame.font.Font = None,
7071
text_hover_color: pygame.Color = WHITE,
7172
complementary_text_lines: Sequence[str] = None,
73+
column_span: int = 1,
7274
) -> None:
73-
super().__init__(position, None, margin)
75+
super().__init__(position, None, margin, column_span)
7476
self.callback: Union[Enum, Callable] = callback
7577
self.size: tuple[int, int] = size
7678

src/pygamepopup/components/dynamic_button.py

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class DynamicButton(Button):
4343
margin (Margin): a tuple containing the margins of the box,
4444
should be in the form "(top_margin, right_margin, bottom_margin, left_margin)", defaults to (0, 0, 0, 0).
4545
disabled (bool): a boolean indicating if it is not possible to interact with the button, defaults to False.
46+
column_span (int): the number of columns the element should span, defaults to 1.
4647
4748
Attributes:
4849
values (Sequence[any]): the sequence of values that will be iterated to determine the next inner value.
@@ -65,6 +66,7 @@ def __init__(
6566
no_background: bool = False,
6667
margin: Margin = (0, 0, 0, 0),
6768
disabled: bool = False,
69+
column_span: int = 1,
6870
) -> None:
6971
# TODO: default background for dynamic button should be used instead of
7072
# letting the ascendant init takes the default one for generic button
@@ -78,6 +80,7 @@ def __init__(
7880
no_background,
7981
margin,
8082
disabled,
83+
column_span
8184
)
8285
self.values: Sequence[any] = values
8386
self.current_value_index: int = current_value_index

src/pygamepopup/components/image_button.py

+3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class ImageButton(Button):
4444
complementary_text_lines (str): the other text lines that should be displayed in addition of
4545
the title.
4646
image_path (str): the relative path to the image that should be displayed on the left (inside of the frame).
47+
column_span (int): the number of columns the element should span, defaults to 1.
4748
"""
4849

4950
def __init__(
@@ -63,6 +64,7 @@ def __init__(
6364
text_hover_color: pygame.Color = MIDNIGHT_BLUE,
6465
complementary_text_lines: Sequence[str] = None,
6566
image_path: str = None,
67+
column_span: int = 1,
6668
) -> None:
6769
super().__init__(
6870
callback,
@@ -79,6 +81,7 @@ def __init__(
7981
font_hover,
8082
text_hover_color,
8183
complementary_text_lines,
84+
column_span,
8285
)
8386

8487
padding: int = size[1] // 10

0 commit comments

Comments
 (0)