-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelloworld.py
More file actions
executable file
·35 lines (26 loc) · 860 Bytes
/
Copy pathhelloworld.py
File metadata and controls
executable file
·35 lines (26 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/python -tt
import pygame
from pygame.locals import *
from sys import exit
pygame.init()
SCREEN_SIZE = (640, 480)
screen = pygame.display.set_mode(SCREEN_SIZE,0,32)
message = " This is a demonstration of the scrolly messae script. "
pygame.display.set_caption('Hello World')
background_image_filename = 'data/noserape.jpg'
background = pygame.image.load(background_image_filename).convert()
font = pygame.font.SysFont("arial",80);
text_surface = font.render(message, True, (0, 0, 255))
x = 0
y = (SCREEN_SIZE[1] - text_surface.get_height())/2
while True:
for event in pygame.event.get():
if event.type == QUIT:
exit()
screen.blit(background, (0,0))
x-= 2
if x < -text_surface.get_width():
x= 0
screen.blit(text_surface, (x, y))
screen.blit(text_surface, (x+text_surface.get_width(), y))
pygame.display.update()