forked from NM-TAFE/civ-ipriot-smiley
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsad.py
46 lines (37 loc) · 1.25 KB
/
sad.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
import time
from smiley import Smiley
class Sad(Smiley):
def __init__(self):
super().__init__()
self.draw_mouth()
self.draw_eyes()
def draw_mouth(self):
"""
Method that draws the mouth on the standard faceless smiley.
"""
mouth = [49, 54, 42, 43, 44, 45]
for pixel in mouth:
self.pixels[pixel] = self.contrast
def change_complexation(self, colour=Smiley.GREEN, contrast=Smiley.RED):
self.complexation(colour,contrast)
self.draw_mouth()
self.draw_eyes()
def draw_eyes(self, wide_open=True):
"""
Method that draws the eyes (open or closed) on the standard smiley.
:param wide_open: True if eyes opened, False otherwise
"""
eyes = [10, 13, 18, 21]
for pixel in eyes:
self.pixels[pixel] = self.contrast if wide_open else self.colour
def blink(self, delay=0.25):
"""
Make the sad smiley blink once with a certain delay (in s).
This is taken from Happy class
:param delay: Delay in seconds
"""
self.draw_eyes(wide_open=False)
self.show()
time.sleep(delay)
self.draw_eyes(wide_open=True)
self.show()