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
| # 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) |
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
| # 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() |
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
| # 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()) |
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
| s = 'bob is cool, really?' | |
| print s | |
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
| # 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) |
NewerOlder