2011-09-07 3 views
0

다음은 스크립트 사본입니다. 이 오류는 라인에 25Python 스크립트 비디오 시스템이 초기화되지 않습니다

import os, sys 
import pygame 
from pygame.locals import * 

if not pygame.font: print 'Warning, fonts disabled' 
if not pygame.mixer: print 'Warning, sound disabled' 

class PyManMain: 
    """The Main PyMan Class - This class handles the main 
    initialization and creating of the Game.""" 

    def __init__(self, width=640,height=480): 
     """Initialize""" 
     """Initialize PyGame""" 
     pygame.init() 
     """Set the window Size""" 
     self.width = width 
     self.height = height 
     """Create the Screen""" 
     self.screen = pygame.display.set_mode((self.width, self.height)) 

     def MainLoop(self): 
      """This is the Main Loop of the Game""" 
    while 1: 
     for event in pygame.event.get(): 
      if event.type == pygame.QUIT: 
       sys.exit() 
       if __name__ == "__main__": 
        MainWindow = PyManMain() 
    MainWindow.MainLoop() 

답변

0

당신은이 코드를 시도 일부 들여 쓰기 문제가 있습니다

import os, sys 
import pygame 
from pygame.locals import * 

if not pygame.font: print 'Warning, fonts disabled' 
if not pygame.mixer: print 'Warning, sound disabled' 

class PyManMain: 
    """The Main PyMan Class - This class handles the main 
    initialization and creating of the Game.""" 

    def __init__(self, width=640,height=480): 
     """Initialize""" 
     """Initialize PyGame""" 
     pygame.init() 
     """Set the window Size""" 
     self.width = width 
     self.height = height 
     """Create the Screen""" 
     self.screen = pygame.display.set_mode((self.width, self.height)) 
     print self.screen 

    def MainLoop(self): 
     """This is the Main Loop of the Game""" 
     while 1: 
      for event in pygame.event.get(): 
       if event.type == pygame.QUIT: 
        sys.exit() 

if __name__ == "__main__": 
    MainWindow = PyManMain() 
    MainWindow.MainLoop() 
관련 문제