enter code here
如何使用我的菜单脚本和IF语句执行我的游戏脚本?我一直在网上寻找答案,但我见过的大部分答案都让我很困惑。我也是陌生人,所以不要判断:x
import pygame
import dumbmenu as dm
pygame.init()
from subprocess import Popen, PIPE
# Variables
red = 255, 0, 0
green = 0,255, 0
blue = 0, 0,255
size = width, height = 340,240
screen = pygame.display.set_mode(size)
screen.fill(blue)
pygame.display.update()
pygame.key.set_repeat(500,30)
choose = dm.dumbmenu(screen, [
'Start Game',
'Quit Game'], 64,64,None,32,1.4,green,red)
if choose == 0:
subpprocess = Popen(['swfdump', 'main.py', '-d'], stdout=PIPE)
stdout, stderr = process.communicate()
elif choose == 1:
pygame.quit()
exit()