我正在尝试用python(使用pygame)制作一个游戏,它使用控制台菜单作为初始程序,如果选择了相应的选项,它会打开一个由pygame生成的图形窗口。我有一个名为“bship.py”的文件,其中包含一个典型的 pygame 应用程序,该应用程序打开一个 800x600 窗口,当按下“1”时我不知道如何打开它……我试过“导入”功能但无济于事。这是代码!
print 'MAIN MENU'
print '----------'
print '\n'
print '1. Play'
print '2. Exit'
print '3. Credits\n\n\n\n\n\n'
menuAnswer = raw_input("> ")
if menuAnswer == '1':
#What is supposed to go here?
#How can I run my pygame file? :P
#"import bship" doesn't seem to work
elif menuAnswer == '2':
exit()
elif menuAnswer == '3':
import Credits
elif menuAnswer != ('1', '2', '3', '4'):
print 'Invalid selection...'
print 'learn to type, \n'
print 'Press ENTER when you are ready'
print 'to accept the repsonsibilities'
print 'of being a player...'
raw_input()