Untitled
unknown
python
10 months ago
907 B
47
Indexable
Thank You. # ----------------------- Instances and Structures, etc ---------------------- # # Button class class Button: def __init__(self, x, y, width, height, text, text_color, button_color): self.rect = pygame.Rect(x, y, width, height) self.text = text self.text_color = text_color self.button_color = button_color def draw(self, screen): pygame.draw.rect(screen, self.button_color, self.rect) font = pygame.font.Font(None, 36) text_surface = font.render(self.text, True, self.text_color) text_rect = text_surface.get_rect(center=self.rect.center) screen.blit(text_surface, text_rect) # Initializations loginBtn = Button(100, 100, 200, 50, "Login", (255, 255, 255), (0, 0, 255))
Editor is loading...
Leave a Comment