Skip to content

Instantly share code, notes, and snippets.

@thillmann50
thillmann50 / Calculator.py
Created September 19, 2014 20:27
Calculator.py
# coding: utf-8
# Calculator
from __future__ import division
import ui
import clipboard
from console import hud_alert
shows_result = False
@thillmann50
thillmann50 / Cards.py
Created September 19, 2014 20:55
Cards.py
# Card Game
#
# In this game, you have to find matching pairs of cards.
# This scene consists entirely of layers and demonstrates some
# interesting animation techniques.
from scene import *
from random import shuffle
from functools import partial
import sound
@thillmann50
thillmann50 / Cascade.py
Created September 19, 2014 20:56
Cascade.py
# Cascade Game
#
# This is a complete game that demonstrates drawing images
# and text, handling touch events and combining simple drawing
# with layer animations.
#
# The game is also known as "Same Game".
# It may appear simple at first, but getting a good score
# actually requires some strategy.
@thillmann50
thillmann50 / Clock.py
Created September 19, 2014 20:56
Clock.py
# Clock
#
# An analog clock that demonstrates drawing basic
# shapes with the scene module.
from scene import *
from time import localtime
ipad = False #will be set in the setup method
@thillmann50
thillmann50 / ColorMixer.py
Created September 19, 2014 20:57
ColorMixer.py
# ColorMixer
# A simple RGB color mixer with three sliders.
import ui
import clipboard
from random import random
from console import hud_alert
def slider_action(sender):
# Get the root view:
@thillmann50
thillmann50 / Image Effects.py
Created September 19, 2014 20:57
Image Effects.py
# Image Effects
# Demonstrates some effects using different modules
# from the Python Imaging Library (PIL).
#
# Tip: You can touch and hold an image in the output
# to copy it to the clipboard or save it to your
# camera roll.
import Image, ImageOps, ImageFilter
from Image import BILINEAR
@thillmann50
thillmann50 / Image Warp.py
Created September 19, 2014 20:57
Image Warp.py
# Image Warp
#
# Demonstrates an interesting use of the image_quad function
# to distort an image based on touch.
from scene import *
from math import sqrt, sin, pi, floor
import Image
M = 16 # number of vert. and horiz. quads in the mesh (16*16=256)
@thillmann50
thillmann50 / Markdown Conversion.py
Created September 19, 2014 20:58
Markdown Conversion.py
# Markdown Conversion
#
# This script demonstrates how you can convert Markdown documents
# to HTML and view the results in the built-in browser.
import os, tempfile, codecs
import console, clipboard, webbrowser
from markdown2 import markdown
DEMO = '''
@thillmann50
thillmann50 / MPL Plot.py
Created September 19, 2014 20:58
MPL Plot.py
# MPL Plot
# A simple demo of using matplotlib in Pythonista.
import console
console.clear()
print 'Generating plot... (this may take a little while)'
import numpy
import matplotlib.pyplot as plt
import math
@thillmann50
thillmann50 / Particles.py
Created September 19, 2014 20:58
Particles.py
# Particles
#
# Create colorful bubbles by moving your fingers.
from scene import *
from random import random
from colorsys import hsv_to_rgb
class Particle (object):
def __init__(self, location):