2
"""Here we load a .TTF font file, and display it in
3
a basic pygame window. It demonstrates several of the
4
Font object attributes. Nothing exciting in here, but
5
it makes a great example for basic window, event, and
10
from pygame.locals import *
17
screen = pygame.display.set_mode(resolution)
19
#the python 1.5.2 way to set the cursor
20
apply(pygame.mouse.set_cursor, pygame.cursors.diamond)
21
#the python 2.0 way to set the cursor
22
#pygame.mouse.set_cursor(*pygame.cursors.diamond)
31
#load font, prepare values
32
font = pygame.font.Font(None, 80)
34
size = font.size(text)
36
#no AA, no transparancy, normal
37
ren = font.render(text, 0, fg, bg)
38
screen.blit(ren, (10, 10))
40
#no AA, transparancy, underline
42
ren = font.render(text, 0, fg)
43
screen.blit(ren, (10, 40 + size[1]))
46
#AA, no transparancy, bold
48
ren = font.render(text, 1, fg, bg)
49
screen.blit(ren, (30 + size[0], 10))
52
#AA, transparancy, italic
54
ren = font.render(text, 1, fg)
55
screen.blit(ren, (30 + size[0], 40 + size[1]))
58
#show the surface and await user quit
61
#use event.wait to keep from polling 100% cpu
62
if pygame.event.wait().type in (QUIT, KEYDOWN, MOUSEBUTTONDOWN):
67
if __name__ == '__main__': main()
b'\\ No newline at end of file'