Menu Pracitce commit pymenu

This commit is contained in:
Stephen Deaton 2024-06-14 17:37:24 -04:00
parent 2322a2de30
commit 9d12890ee3
3 changed files with 72 additions and 5 deletions

View File

@ -0,0 +1,33 @@
import random
import pygame
import pygame_gui
import sys
pygame.init()
pygame.display.set_caption('Dice Roll')
window_surface = pygame.display.set_mode((800, 600))
background = pygame.Surface((800, 600))
background.fill(pygame.Color('#009900'))
manager = pygame_gui.UIManager((800, 600))
is_running = True
while is_running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
is_running = False
window_surface.blit(background, (0, 0))
pygame.display.update()

31
PyGame/practice/prac.py Normal file
View File

@ -0,0 +1,31 @@
import pygame
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()
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
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()

View File

@ -1,14 +1,17 @@
import json
import random
import pygame
from pathlib import Path
from typing import List
from Rooms import Room
my_rooms = []
raw_room_data = Path('room_data.json').read_text()
room_data = json.loads(raw_room_data)
for room in room_data:
my_rooms.append(Room(room['grid_col'], room['grid_row'], room['name'], room['description'], room['dark']))
background_colour = (0, 76, 153)
screen = pygame.display.set_mode((400, 300))
pygame.display.set_caption('Dice Rolling')
screen.fill(background_colour)
pygame.display.flip()
running = True
dice = ["1", "2",]
sides = ["4", "6", "8", "10", "12", "20"]