Skip to content

Instantly share code, notes, and snippets.

View SpaceVoyager's full-sized avatar

Yuhang Wang SpaceVoyager

View GitHub Profile
@SpaceVoyager
SpaceVoyager / fathers day.py
Created June 13, 2015 20:47
fathers day.py
# Example father's day card with animation and sound
import canvas
import speech
from time import sleep
sleepfor = 0.1 # the number of seconds to sleep for
canvas.set_size(1000,600)
canvas.draw_image('_family', 0, 0, 1000, 600)
# Rabbit with a spining propeller
from scene import *
from random import random
class MyScene (Scene):
def setup(self):
# This will be called before the first frame is drawn.
# Set up the root layer and one other layer:
self.root_layer = Layer(self.bounds)
center = self.bounds.center()
# An more interesting Pyhthonista 'Hello World' program
# Written by Yuhang Wang for A2PyKids
import console
import canvas
from random import random
import speech
# Ask for your name and then write it in random color on screen
canvas.set_size(1000, 600)
canvas.set_fill_color(random(), random(), random())
s = 'bob is cool, really?'
print s
# draws a bunch of Christmas trees
# writen by Yuhang Wang for A2PyKids
import canvas
from math import sin, cos, pi
# draws a star
def draw_star(x, y, inner_r, outer_r, jags):
canvas.set_fill_color(1,1,0.2)
canvas.move_to(x, y + outer_r)