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
# imageCongaLine.py | |
# A Conga line formed out of .png images inside Pythonista.app | |
import os, scene | |
imageWidth = 32 | |
#print(os.getcwd()) | |
os.chdir('../Pythonista.app') # Look at files inside the app | |
#print(os.listdir('.')) |
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
# sounder.py | |
# play each of the .caf sounds inside the Pythonista.app | |
import os, os.path, scene, sound | |
framesPerSound = 60 | |
pythonistaDir = os.path.expanduser('~/Pythonista.app') | |
#print(os.listdir(pythonistaDir)) | |
soundFileExtention = '.caf' | |
wallpaperAppIcon = ('/AppIcon76x76@2x~ipad.png', '/[email protected]') |
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
import scene, os | |
colorLightBlue = scene.Color(.3, .3, 1) | |
colorWhite = scene.Color( 1, 1, 1) | |
fontBlackList = ('AcademyEngraved', 'AppleColorEmoji@2x', | |
'ArialHB', 'Bodoni72', 'ChalkboardSE', | |
'CourierNew', 'DB_LCD_Temp-Black', | |
'EuphemiaCAS', 'Fallback', 'HoeflerText', | |
'LastResort', 'KGPW3UI', 'LockClock', |
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
# The GPS issue was fixed quite elegantly with the location module | |
# added in Pythonista v1.4. The code below is not longer required. | |
# gpsForPythonista using BaseHTTPServer and XMLHttpRequest | |
# Source at https://gist.github.com/cclauss/6578926 | |
# Thanks to 'Hvmhvm' of Pythonisa fourm for working code | |
# Thanks to 'Anton2' of Pythonisa fourm for XMLHttpRequest | |
# http://omz-software.com/pythonista/forums/discussion/92/gps-access-solved | |
# usage: from gpsForPythonista import getGPS; print(getGPS()) |
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
# Display the current clipboard text in full screen mode | |
import clipboard, console, scene | |
clipText = clipboard.get() | |
if not clipText: | |
clipText = """Hang up your cellphone and drive your car!!!""" | |
zclipText = """Please take me home...""" | |
class MyScene(scene.Scene): | |
def setup(self): | |
(imageName, imageSize) = self.getImageNameAndSize() |
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
#!/usr/bin/env python | |
# create a BeautifulSoup by reading in a webpage | |
# Current varsion at https://gist.github.com/cclauss/6648735 | |
# usage: | |
# from soupFromURL import soupFromURL | |
# theSoup = soupFromURL('http://www.python.org') | |
import bs4 | |
useRequests = False # "Python HTTP: When in doubt, or when | |
try: # not in doubt, use Requests. Beautiful, |
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
# Current version at https://gist.github.com/cclauss/6656495 | |
import console | |
addPrompt = """Item to be added to the list? | |
or [M] to return to the main menu:""" | |
removePrompt = """Item to be removed from the list? | |
or [M] to return to the main menu:""" | |
def writeListToFile(inFileName, inList): |
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
# helloBarcode - ZBar delivers barcode data to Pythonista | |
programName = sys.argv[0].rpartition('/')[2] | |
theBarcode = sys.argv[1] if len(sys.argv) > 1 else None | |
fmt = '{} was launched with barcode: {}' | |
print(fmt.format(programName, theBarcode)) | |
# Save this file in Pythonista as 'helloBarcode'. | |
# Download free app ZBar from the iTunes App Store. | |
# Launch ZBar on your device. | |
# Scan the barcode on a book, coke can, whatever. |
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
# beazleyCodeDownload.py | |
# | |
# copy source code from http://www.dabeaz.com | |
# into local directory David_Beazley | |
import bs4, os, requests | |
codeBases = ('coroutines', 'generators', 'pydata', | |
'python3io', 'usenix2009/concurrent') | |
baseURLFmt = 'http://www.dabeaz.com/{}/' |
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
''' | |
create three background images in scene.setup() then in | |
scene.draw() use the x coordinate of the user's drag | |
location to determine which background image to display | |
''' | |
import scene | |
from PIL import Image, ImageDraw, ImageFont | |
theMessage = 'Drag the grey circle left and right to switch between the background images.' |