-
Notifications
You must be signed in to change notification settings - Fork 0
/
BlitTest.py
56 lines (44 loc) · 1.19 KB
/
BlitTest.py
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Simple demo usuing blit to copy alternating pattern to screen
import pew
# Intialise Device
pew.init()
# Create Blank Screen Image
screen = pew.Pix()
# Set Loop Delay Value in Seconds
delay = 1/6
# Setup String to hold pattern to be used as background
background = pew.Pix.from_iter((
(1, 0, 1, 0, 1, 0, 1, 0),
(0, 1, 0, 1, 0, 1, 0, 1),
(1, 0, 1, 0, 1, 0, 1, 0),
(0, 1, 0, 1, 0, 1, 0, 1),
(1, 0, 1, 0, 1, 0, 1, 0),
(0, 1, 0, 1, 0, 1, 0, 1),
(1, 0, 1, 0, 1, 0, 1, 0),
(0, 1, 0, 1, 0, 1, 0, 1),
))
# Setup String to hold pattern to be used as second background
background2 = pew.Pix.from_iter((
(0, 1, 0, 1, 0, 1, 0, 1),
(1, 0, 1, 0, 1, 0, 1, 0),
(0, 1, 0, 1, 0, 1, 0, 1),
(1, 0, 1, 0, 1, 0, 1, 0),
(0, 1, 0, 1, 0, 1, 0, 1),
(1, 0, 1, 0, 1, 0, 1, 0),
(0, 1, 0, 1, 0, 1, 0, 1),
(1, 0, 1, 0, 1, 0, 1, 0),
))
# Loop Forever
while True:
# Copy Image Stored in ( background ) to screen
screen.blit(background)
# Update Screen
pew.show(screen)
# Pause
pew.tick(delay)
# Copy Image Stored in ( background2 ) to screen
screen.blit(background2)
# Update Screen
pew.show(screen)
# Pause
pew.tick(delay)