@@ -20,16 +20,18 @@ class BoxElement:
20
20
In fact, it adds a margin to any border of an element to have a cleaner interface.
21
21
22
22
Keyword arguments:
23
- position (Position): the position of the box on the screen
24
- content (Optional[pygame.Surface]): a surface that will be wrapped by the box
23
+ position (Position): the position of the box on the screen.
24
+ content (Optional[pygame.Surface]): a surface that will be wrapped by the box.
25
25
margin (Margin): a tuple containing the margins of the box, should be in the form
26
- "(top_margin, right_margin, bottom_margin, left_margin), defaults to (0, 0, 0, 0)"
26
+ "(top_margin, right_margin, bottom_margin, left_margin), defaults to (0, 0, 0, 0)".
27
+ column_span (int): the number of columns the element should span, defaults to 1.
27
28
28
29
Attributes:
29
- position (Position): the position of the box on the screen
30
- content (Optional[pygame.Surface]): the element wrapped in the box
30
+ position (Position): the position of the box on the screen.
31
+ content (Optional[pygame.Surface]): the element wrapped in the box.
31
32
size (tuple[int, int]): the size of the content following the format "(width, height)"
32
- margin (dict[str, int]): a dict containing all the values for margins TOP, BOTTOM, LEFT and RIGHT
33
+ margin (dict[str, int]): a dict containing all the values for margins TOP, BOTTOM, LEFT and RIGHT.
34
+ column_span (int): the number of columns the element should span.
33
35
"""
34
36
35
37
def __new__ (cls , * args , ** kwargs ):
@@ -45,6 +47,7 @@ def __init__(
45
47
position : Position ,
46
48
content : Optional [pygame .Surface ],
47
49
margin : Margin = (0 , 0 , 0 , 0 ),
50
+ column_span : int = 1 ,
48
51
) -> None :
49
52
self .position : Position = position
50
53
self .content : pygame .Surface = content
@@ -57,6 +60,7 @@ def __init__(
57
60
"LEFT" : margin [3 ],
58
61
"RIGHT" : margin [1 ],
59
62
}
63
+ self .column_span = column_span
60
64
61
65
def get_width (self ) -> int :
62
66
"""
0 commit comments