Merge branch 'master' of git.ucc.asn.au:/matches/honours
[matches/honours.git] / research / transmission_spectroscopy / simulator / pgu-0.18 / examples / text1.py
1 """<title>an example of text usage</title>"""
2 import pygame
3 from pygame.locals import *
4
5 # the following line is not needed if pgu is installed
6 import sys; sys.path.insert(0, "..")
7
8 from pgu import text
9
10 pygame.font.init()
11
12 screen = pygame.display.set_mode((640,480),SWSURFACE)
13 fg = (0,0,0)
14 bg = (0,192,255)
15 screen.fill(bg)
16 bg = (255,255,255)
17
18 font = pygame.font.SysFont("default", 24)
19
20 ##::
21 text.write(screen,font,(0,0),bg,"Hello World!")
22 text.writec(screen,font,bg,"Centered Text")
23 text.writepre(screen,font,pygame.Rect(160,48,320,100),fg,"""This is some
24 preformatted
25     t e  x   t""")
26 text.writewrap(screen,font,pygame.Rect(160,268,320,100),fg,"""This is some text that will wrap automatically. This is some text that will wrap automatically.
27  
28 This is some text that will wrap automatically. This is some text that will wrap automatically.""")
29 ##
30     
31 pygame.display.flip()
32
33 _quit = 0
34 while not _quit:
35     for e in pygame.event.get():
36         if e.type is QUIT: _quit = 1
37     pygame.time.wait(10)

UCC git Repository :: git.ucc.asn.au