import pygame font = pygame.font.SysFont('Arial', 40) class Button(): def __init__(self, x, y, width, height, buttonText='Button', onclickFunction=None, onePress=False): self.x = x self.y = y self.width = width self.height = height self.onclickFunction = onclickFunction self.onePress = onePress self.alreadyPressed = False self.fillColors = { 'normal': '#ffffff', 'hover': '#666666', 'pressed': '#333333', } self.buttonSurface = pygame.Surface((self.width, self.height)) self.buttonRect = pygame.Rect(self.x, self.y, self.width, self.height) self.buttonSurf = font.render(buttonText, True, (20, 20, 20)) return self