This commit is contained in:
206530219 2021-06-17 11:06:54 +08:00
parent f12a8fe05b
commit 2c3f2ad90e
1 changed files with 16 additions and 0 deletions

16
button.py Normal file
View File

@ -0,0 +1,16 @@
import pygame.font
class play_Button():
def __init__(self, ai_settings, screen, msg):
"""初始化按钮的属性"""
self.screen = screen
self.screen_rect = screen.get_rect()
# 设置按钮的尺寸和其他属性
self.width, self.height = 200, 50 # 按钮的尺寸
self.button_color = (0, 0, 0) # 按钮颜色
self.text_color = (255, 255, 255) # 按钮中文本的颜色
self.font = pygame.font.SysFont(None, 48)
# 创建按钮的rect对象
self.rect = pygame.Rect(540, 300, self.width, self.height)
# self.rect.center = self.screen_rect.center
# 按钮的标签只需创建一次
self.prep_msg(msg)