diff --git a/pg.py b/pg.py index 568ba12..892bd7d 100644 --- a/pg.py +++ b/pg.py @@ -22,6 +22,9 @@ default_font = pygame.font.Font(pygame.font.get_default_font(), 16) class Hover: + """ + Used to execute a function when the mouse hovers over a rectangle. + """ def __init__(self, rect: pygame.Rect, function=None, args: tuple=None): self.rect = rect self.function = function @@ -47,6 +50,9 @@ class Hover: class Button: + """ + Creates a button from a pygame.Rect. + """ def __init__(self, rect: pygame.Rect, function=None, args: tuple=None, key: int=0): # key: 0 = left 1 = mouse wheel pressed 2 = right self.rect = rect self.function = function @@ -69,6 +75,9 @@ class Button: class TextButton: + """ + Creates a button from just some string and a position. + """ def __init__(self, text: str, position: tuple, function=None, args: tuple=None, key: int=0, text_color: tuple=white, bg_color: tuple=gray, font: pygame.font.Font=default_font, padding: tuple=(8, 8), border_radius: int=0, line_thickness: int = 0): self.text = text self.position = position @@ -121,6 +130,9 @@ class TextButton: class TextInput: + """ + Creates an input object at a given position. + """ def __init__( self, position: Union[tuple, Callable], @@ -431,6 +443,9 @@ class MultilineText: def set_rot_point(img, pos): + """ + Blits the image on an empty surface to change the center of rotation. + """ w, h = img.get_size() w, h = w * 2, h * 2