class Button(object): def __init__(self,x,y,width,height,color): self.rect = pygame.Rect(x,y,width,height) self.image=pygame.draw.rect(screen, color,(self.rect),) self.x=x self.y=y self.width=width self.height=height def check(self): return self.rect.collidepoint(pygame.mouse.get_pos())