Created
March 19, 2019 03:02
-
-
Save codehearts/2f946708143a0bf9540cf3d02d81bdb9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Moon(object): | |
"""Graphical moon object""" | |
PHASES = ('new', 'waxing-crescent', 'first-quarter', 'waxing-gibbous', | |
'full', 'waning-gibbous', 'third-quarter', 'waning-crescent') | |
def __init__(self, x, y): | |
"""Creates a new moon at the coordinates""" | |
self._x, self._y = x, y | |
def animate_phases(self): | |
"""Animates the phases of the moon""" | |
for phase in Moon.PHASES: | |
phase_image = Image('{}.png'.format(phase)) | |
phase_image.blit(self._x, self._y) | |
time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment