View SpaceShooter.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
from scene import * | |
from random import randint, random, choice | |
from sound import play_effect | |
from colorsys import hsv_to_rgb | |
from math import sin | |
from functools import partial | |
from copy import copy | |
class Star (object): | |
def __init__(self): |
View ShortcutGenerator.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
# This script adds a "Webclip" shortcut to your homescreen. | |
# The shortcut can be used to open a web page in full-screen mode, | |
# or to launch a custom URL (e.g. a third-party app). | |
# You'll be asked for a title, a URL, and an icon (from your camera roll) | |
import plistlib | |
import BaseHTTPServer | |
import webbrowser | |
import uuid | |
from io import BytesIO |
View FileTransfer.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
# File Transfer for Pythonista | |
# ============================ | |
# This script allows you to transfer Python files from | |
# and to Pythonista via local Wifi. | |
# It starts a basic HTTP server that you can access | |
# as a web page from your browser. | |
# When you upload a file that already exists, it is | |
# renamed automatically. | |
# From Pythonista's settings, you can add this script | |
# to the actions menu of the editor for quick access. |
View FontInstaller.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
# FontInstaller (by @olemoritz) | |
# This script installs a custom TTF font on iOS (system-wide). | |
# It can be used in one of two ways: | |
# 1. Simply run it in Pythonista, you'll be prompted for the URL of the font | |
# you'd like to install (if there's a URL in the clipboard, it'll be used by default) | |
# 2. Use it as an 'Open in...' handler, i.e. select this file in Pythonista's 'Open in... | |
# menu' setting. This way, you can simply download a ttf file in Safari and open it in |
View Pythonista Theme Editor.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
# coding: utf-8 | |
''' | |
Basic theme editor for Pythonista 1.6 (beta) | |
WARNING: Use at your own risk! User themes aren't "officially" supported, and | |
this may break in future versions. If you enter invalid JSON or anything else | |
that the app can't deal with, it *will* crash -- your input is not validated | |
in any way. | |
''' |
View UI Debugging Overlay.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
# Pythonista script to show the UI Debugging overlay (private API) described in this blog post: | |
# http://ryanipete.com/blog/ios/swift/objective-c/uidebugginginformationoverlay/ | |
from objc_util import ObjCClass, on_main_thread | |
UIDebuggingInformationOverlay = ObjCClass('UIDebuggingInformationOverlay') | |
@on_main_thread | |
def toggle_overlay(): | |
UIDebuggingInformationOverlay.prepareDebuggingOverlay() | |
UIDebuggingInformationOverlay.overlay().toggleVisibility() |
View CoreML Image Recognition.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
#!python3 | |
''' | |
This is a demo of how you can use the CoreML framework (via objc_util) to classify images in Pythonista. It downloads the trained 'MobileNet' CoreML model from the Internet, and uses it to classify images that are either taken with the camera, or picked from the photo library. | |
''' | |
import requests | |
import os | |
import io | |
import photos | |
import dialogs |
View PythonistaBackup.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
# coding: utf-8 | |
'''Creates a zip archive of your Pythonista files and serves them via HTTP in your local network.''' | |
import sys | |
if sys.version_info[0] >= 3: | |
from http.server import SimpleHTTPRequestHandler, HTTPServer | |
else: | |
from SimpleHTTPServer import SimpleHTTPRequestHandler | |
from BaseHTTPServer import HTTPServer |
View Check dictionary word.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
# coding: utf-8 | |
''' | |
Demo of using the built-in iOS dictionary to check words | |
NOTES: This is quite slow, it might be possible to use the spell-checking | |
dictionary for this instead, haven't tried that yet. | |
If no dictionary is downloaded yet, the API will always return True | |
(probably so that the "Define" menu item can be shown before | |
a dictionary has been downloaded). | |
''' |
View FileBrowser.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
import SimpleHTTPServer | |
import SocketServer | |
import webbrowser | |
import os | |
os.chdir('/') | |
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler | |
httpd = SocketServer.TCPServer(("", 0), Handler) | |
port = httpd.server_address[1] | |
webbrowser.open('http://localhost:' + str(port), stop_when_done=True) | |
httpd.serve_forever() |
NewerOlder