Hardware Reference
In-Depth Information
To see how these ideas pan out, look at Listing 4-2. his program is a bit more of a test than
the previous one with some debug printout. his results in some rather jerky scrolling, but
that will be ixed when you remove the printout.
Listing 4-2 Scrolling Words
#!/usr/bin/env python
“””
Here is the News
A Raspberry Pi Auto Cue Test 2
“””
import time # for delays
import os, pygame, sys
pygame.init() # initialise graphics interface
os.environ['SDL_VIDEO_WINDOW_POS'] = 'center'
pygame.display.set_caption(“Auto Cue Test 2”)
screenWidth = 980
screenHeight =610
screen = pygame.display.set_mode([screenWidth, ;
screenHeight],0,32)
background = pygame.Surface((screenWidth,screenHeight))
segments = 4
segment = 0 # initial start place
textHeight = screenHeight / segments
textSurface = [ pygame.Surface((screenWidth,textHeight));
for s in range(0,segments+1)]
# define the colours to use for the user interface
cBackground =(0,0,0)
cText = (255,255,255)
scrollSize = 30
background.fill(cBackground) # make background colour
font = pygame.font.Font(None, textHeight)
numberOfLines = 0
newsLines = list()
def main():
print”Here is the news”
getNews()
lines = 0
while lines < numberOfLines :
for i in range(segments, 0, -1): ;
Search WWH ::




Custom Search