Button¶
- class src.button.ButtonHex(x_y_pos, radius, color, is_filled=True)[source]¶
A class for creating and drawing hexagonal buttons.
- Parameters:
x_y_pos (tuple) – A tuple of the x and y coordinates of the center of the button.
radius (int) – The radius of the button.
color (tuple) – The color of the button.
is_filled (bool) – Whether or not the button should be filled in. Defaults to True.
- draw(surface)[source]¶
Draws the hexagonal button onto the specified pygame surface.
- Parameters:
surface (pygame.Surface) – The pygame surface to draw the button onto.
- class src.button.ButtonRect(x_y_pos, width_height, text, colors)[source]¶
A class representing a rectangular button.
- Parameters:
x_y_pos – A tuple representing the x and y
coordinates of the top-left corner of the button. :type x_y_pos: Tuple[int, int] :param width_height: A tuple representing the width and height of the button. :type width_height: Tuple[int, int] :param text: The text displayed on the button. :type text: str :param colors: A tuple containing the colors of the button and its highlight when hovered over. :type colors: Tuple[Tuple[int, int, int], Tuple[int, int, int]]
- draw(surface)[source]¶
Draw the button onto the specified surface.
- Parameters:
surface (pygame.Surface) – The surface to draw the button onto.