pygame.Font

来源:互联网 发布:java微信号自定义菜单 编辑:程序博客网 时间:2024/06/08 06:17


import pygame,sys
from pygame.locals import *


pygame.init()
DISPLAYSURF = pygame.display.set_mode((800,600))

#使用系统字体,或者自己加载字体库
myFont = pygame.font.SysFont("arial", 14)
words = myFont.render("hello world",True,(255,0,0))


while True:

DISPLAYSURF.fill((255,255,255))

for event in pygame.event.get():

if event.type == pygame.QUIT:

sys.exit()

DISPLAYSURF.blit(words,(0,0))

pygame.display.update()