This file contains 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 bs4, collections, console, requests, scene | |
tkColorDict = collections.OrderedDict() # key = tkinter color name | |
def loadTkColorDict(): # will automaticly be called by getColor() if needed | |
tkColorURL = 'http://www.tcl.tk/man/tcl8.6/TkCmd/colors.htm' | |
print('Loading tkinter colors from: ' + tkColorURL) | |
tkColorSoup = bs4.BeautifulSoup(requests.get(tkColorURL).text).tbody | |
print('Soup is ready. Creating color table...') | |
for tableRow in tkColorSoup.find_all('tr'): |
This file contains 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
# Update: This looks like a far better solution... | |
# `console.set_idle_timer_disabled(flag)` | |
# Disable or enable the idle timer (which puts the device to sleep after a certain period of inactivity). | |
# noDoze.py -- keep relaunching yourself to prevent | |
# your iOS device from falling asleep. | |
import notification, time, urllib | |
def argsString(argv): |
This file contains 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', '/AppIcon60x60@2x.png') |
This file contains 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 | |
''' | |
recent_entries() will print out info on all posts to the Pythonista forum in the past 24 hours. | |
watch_feed() will print out info on the last post to the Pythonista forum. | |
Sleeps for 15 minutes then check to see if there is a newer post. | |
If so, prints out info on it and opens its URL in the webbrowser. Repeat. | |
''' |
This file contains 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 improved version at https://github.com/cclauss/Ten-lines-or-less/blob/master/elapsed_time.py | |
import math, time | |
def elapsedTime(start_time): | |
dt = time.time() - start_time | |
minutes = dt / 60 | |
seconds = dt % 60 | |
centiseconds = math.modf(dt)[0] * 100 | |
return '%02d:%02d.%02d' % (minutes, seconds, centiseconds) |
This file contains 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 json, requests, sys #, pprint | |
''' | |
https://github.com/taherh/twitter_application_auth/blob/master/get_bearer_token.py | |
Use get_bearer_token.py (works on Pythonista) to get your Twitter access_token. | |
> You will need to create a new application on https://dev.twitter.com | |
> Enter below the Twitter access_token you get from running get_bearer_token.py | |
''' |
This file contains 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 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 Image, ImageDraw, scene | |
def diagonalLineImage(inLength = 200, inColors = ('blue', 'ivory')): | |
imageLength = inLength + 100 # the image can be larger than what you draw | |
theImage = Image.new('RGBA', (imageLength, imageLength), inColors[1]) | |
draw = ImageDraw.Draw(theImage) | |
draw.line((0, 0, inLength, inLength), fill = inColors[0]) | |
del draw | |
return theImage |
This file contains 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
Moved to GitHub repo: https://github.com/cclauss/Open_Data |
This file contains 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
# -*- coding: utf-8 -*- | |
import scene | |
keyboard_layouts = ( | |
''' | |
q w e r t y u i o p del | |
a s d f g h j k l return | |
z x c v b n m , . shift | |
.?123 space .?123 |
NewerOlder