Hello Pygame程序

来源:互联网 发布:英国网络运营商 编辑:程序博客网 时间:2024/05/16 07:01
# Hello Pygame project
import pygame
from pygame.locals import *
white = 255,255,255
blue = 0,0,255
# initialize Pygame
pygame.init()
screen = pygame.display.set_mode((600,500))
# support TrueType font type."None"will be lead to the default Pygame font type
myfont = pygame.font.Font(None,60)
textImage = myfont.render("Hello Pygame",True,white)
while True:
    for event in pygame.event.get():
        if event.type in (QUIT,KEYDOWN):
            pygame.quit()
    screen.fill(blue)
    screen.blit(textImage,(100,100))
    pygame.display.update()        

0 0
原创粉丝点击