Skip to content

Instantly share code, notes, and snippets.

View cclauss's full-sized avatar

Christian Clauss cclauss

View GitHub Profile
@cclauss
cclauss / draggableImages.py
Last active December 16, 2015 04:49
draggableImages demo for Pythonista on iOS.
# http://omz-forums.appspot.com/pythonista/post/5144563366756352
import random, scene
sizeInPixels = 100
def rectFromPt(inPoint): # returns a scene.Rect centered on inPoint
half = sizeInPixels / 2
return scene.Rect(inPoint.x - half, inPoint.y - half, sizeInPixels, sizeInPixels)
@cclauss
cclauss / blueMaze.py
Created March 31, 2013 20:36
blueMaze -- just a hack to get to know the Pythonista graphics Scene class..
from scene import *
from random import random
class MyScene (Scene):
def setup(self):
# This will be called before the first frame is drawn.
self.root_layer = Layer(self.bounds)
self.mLines = []
self.mCount = 0
(self.mCurrLocX, self.mCurrLocY) = self.bounds.center()
@cclauss
cclauss / installNyamuk.py
Created March 9, 2013 09:47
Using nyamuk on Pythonista on iOS. > Download from github the nyamuk Python library and install it for Pythonista on iOS.
#!/usr/bin/env python
# installNyamuk -- https://github.com/iwanbk/nyamuk
# download from github the nyamuk Python library and install it for Pythonista on iOS
#import nyamuk, sys # uncomment if you want to test if nyamuk is already installed
#print('got it...')
#sys.exit()
import os, shutil, urllib, zipfile
@cclauss
cclauss / theBlues.py
Last active December 14, 2015 10:38
Play a blues melody on Pythonista on the iPad (iOS)
# Play a blues melody on Pythonista on the iPad (iOS)
import sound
import time
def playNotes(inNotes, inWithEmphisis=False):
for note in inNotes:
sound.play_effect('Piano_' + note)
if (inWithEmphisis):
time.sleep(0.25)
sound.play_effect('Piano_' + note)