BigSteve/PyGame/practice/prac.py

48 lines
1.0 KiB
Python

import pygame
import sys
import pygame_menu
pygame.init()
screen_width = 800
screen_height = 600
screen = pygame.display.set_mode((screen_width, screen_height))
color = (128, 128, 128)
screen.fill(color)
pygame.display.set_caption('Dice Roll')
clock = pygame.time.Clock()
# button.png is 200x61
roll_img = pygame.image.load('button.png').convert_alpha()
class Button():
def __init__(self, x, y, image):
self.image = image
self.rect = self.image.get_rect()
self.rect.topleft = (x, y)
def draw(self):
screen.blit(self.image, (self.rect.x, self.rect.y))
roll_button = Button(((screen_width // 2) // 2) - (roll_img.get_width() // 2), 200, roll_img)
def set_number_dice(value: str, die_number: int):
# Do the job here !
pass
def set_dice_sides(value: str, sides: int):
# Do the job here !
pass
roll_button.draw()
run = True
while run == True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
pygame.display.flip()
clock.tick(60)
pygame.quit()