0

How would I execute my game script using my menu script with the IF statement? I've been searching all over the internet for the answer, but most of the answers I've seen have been quite confusing to me.

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()
Smart Manoj
  • 4,375
  • 4
  • 27
  • 51
  • Please try to be more clear with your problem. It's not clear where you are facing the issue. Can you post some code and tell us where you are facing problems? – gravetii Jan 22 '14 at 05:07
  • I've edited the post with my code that i have for my menu script. After the IF statement, I want the code to open up my game script. I've tried the subprocess, but it seemed to have not worked oem – user3222046 Jan 22 '14 at 05:10
  • Just describing what you tried to do makes it impossible for us to debug your code. You have to actually show it to us. Please read [MCVE](http://stackoverflow.com/help/mcve) for what should go into your question. – abarnert Jan 22 '14 at 05:16
  • I've added in the full code. When I am trying to use subprocess to open up my main game script, it wont open it up for some odd reason. Am I using subprocess incorrectly ? – user3222046 Jan 22 '14 at 05:21

0 Answers0