-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_button.py
More file actions
23 lines (20 loc) · 898 Bytes
/
start_button.py
File metadata and controls
23 lines (20 loc) · 898 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import pygame.font
class Play_button(object):
def __init__(self, screen, button_text):
self.screen = screen
self.screen_rect = screen.get_rect()
self.width = 250
self.height = 100
self.button_color = 0, 200, 150
self.text_color = 255, 255, 255
self.font = pygame.font.Font(None, 52)
self.rect = pygame.Rect(0, 0, self.width, self.height)
self.rect.center = self.screen_rect.center
self.setup_message(button_text)
def setup_message(self, button_text):
self.image_message = self.font.render(button_text, True, self.text_color)
self.image_message_rect = self.image_message.get_rect()
self.image_message_rect.center = self.rect.center
def draw_button(self):
self.screen.fill(self.button_color, self.rect)
self.screen.blit(self.image_message, self.image_message_rect)