Dingoonity.org

GCW Zero => Development => Topic started by: DeusDormouse on October 07, 2014, 09:25:56 pm

Title: Pygame - Font Test
Post by: DeusDormouse on October 07, 2014, 09:25:56 pm
Code: [Select]
import sys, pygame
from pygame.locals import *

pygame.init()
DISPLAYSURF = pygame.display.set_mode((320, 240))
pygame.mouse.set_visible(False)

GREEN = (0, 128, 0)
BLUE = (0, 0, 128)

AA = True

fontObj = [pygame.font.Font('freesansbold.ttf', point) for point in xrange(8, 55, 8)]
fontRen = [fObj.render('Hello {}'.format(fObj.get_height() - 1), AA, GREEN, BLUE) for fObj in fontObj]

point = 8
for fRen in fontRen:
    DISPLAYSURF.blit(fRen, (0, point))
    point += point

pygame.display.update()
pygame.time.wait(10000)

pygame.quit()
sys.exit()