Created
June 6, 2015 23:23
-
-
Save ssophwang/2e19523a0c064bf6bf83 to your computer and use it in GitHub Desktop.
fathers_day.py
This file contains hidden or 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
# A2PyKids class homework 1 | |
import canvas | |
import speech | |
from random import random | |
# write a bunch of Happy Fathers Day's | |
canvas.set_size(1000, 600) | |
text = "Happy Father's Day!" | |
fnt = 'Helvetica-Bold' | |
y = -50 | |
for i in range(6): | |
canvas.set_fill_color(random(), random(), random()) | |
size = 112 - (i+1)*10 | |
x = i*50 | |
y = y + size*1.2 | |
canvas.draw_text(text, x, y, fnt, size) | |
# Also let siri speak it out | |
speed = i/6.0 | |
speech.say(text, 'en-US', speed) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment