标签:blog color ar for 2014 sp log on c
import traceback import pygame from pygame.locals import * pygame.display.init() sizes = { "screen" : [ 640, 480 ] } colors = { "screen" : ( 255, 255, 255 ) } screen = pygame.display.set_mode( sizes["screen"], 0, 32 ) def cin(): for e in pygame.event.get(): if e.type == KEYDOWN: if e.key == K_ESCAPE: return False return True def draw(): screen.fill( colors["screen"] ) pygame.display.update() def prepare( func ): def _pre(): pygame.event.set_grab( True ) func() pygame.event.set_grab( False ) pygame.quit() return _pre @prepare def main(): while True: if not cin(): break draw() if __name__ == '__main__': try: main() except: traceback.print_exc() pygame.quit() input()
标签:blog color ar for 2014 sp log on c
原文地址:http://blog.csdn.net/pandora_madara/article/details/39154081