View screenspeedtest.py
import ui, io, Image, matplotlib.image,numpy, timeit | |
print(__file__) | |
A=numpy.random.rand(300,300,3) | |
Au=(255*A).astype('uint8') | |
B=io.BytesIO() | |
def p(format='jpeg'): | |
B.seek(0) | |
Image.fromarray(Au).save(B,format=format) | |
return ui.Image.from_data(B.getvalue()) | |
def m(format='jpeg'): |
View audiounittest.py
from objc_util import * | |
from ctypes import * | |
from coreaudioconstants import * | |
''' Adapted from https://www.cocoawithlove.com/2010/10/ios-tone-generator-introduction-to.html | |
''' | |
AudioUnitRenderActionFlags=c_uint32 | |
OSStatus=c_int32 | |
OSType=c_uint32 |
View inputAccessoryExample.py
# coding: utf-8 | |
'''Creates a custom input accessory view, and attaches it to textfield and textview | |
this example demonstrates custom text buttons (emoji, etc), and custom actions | |
''' | |
from objc_util import * | |
import ui | |
'''set up top level view and textfield''' | |
v=ui.View(frame=[0,0,300,300],bg_color=(.92, .92, .92)) | |
tf=ui.TextField(frame=[10,10,200,30]) |
View 3dview.py
from scene import * | |
#import sound | |
import random | |
import math | |
import numpy as np | |
A = Action | |
class Shape3D (object): |
View Untitled_203.py
import ui, random | |
pyui=''' | |
\n[\n{\n"class":"View",\n"attributes":{\n"background_color":"RGBA(1.000000,1.000000,1.000000,1.000000)",\n"tint_color":"RGBA(0.000000,0.478000,1.000000,1.000000)",\n"enabled":true,\n"border_color":"RGBA(0.000000,0.000000,0.000000,1.000000)",\n"flex":""\n},\n"frame":"{{0,0},{240,240}}",\n"selected":false,\n"nodes":[\n{\n"class":"Button",\n"attributes":{\n"font_size":15,\n"tint_color":"RGBA(1.000000,0.511111,0.266667,1.000000)",\n"title":"Button",\n"name":"button1",\n"class":"Button",\n"frame":"{{80,104},{80,32}}",\n"background_color":"RGBA(1.000000,0.755556,0.633333,1.000000)",\n"uuid":"EBCC1C1F-4705-4F87-A6A1-07C0A50D7116"\n},\n"frame":"{{27,25},{80,87}}",\n"selected":true,\n"nodes":[\n\n]\n}\n]\n}\n]\n | |
''' | |
class bgLines(ui.View): | |
def draw(self): #drawing must happen in draw | |
self.w = ui.get_screen_size()[0] | |
self.h = ui.get_screen_size()[1] | |
self.lines=[] |
View turtle2.py
#\input texinfo | |
# coding: utf-8 | |
# ui-based iOS port of the turtle module (not 100% compatible with standard library | |
# turtle module, but most things beginners would use should work) | |
import ui | |
from math import * | |
import math | |
import time |
View turtle2.py
#\input texinfo | |
# coding: utf-8 | |
# ui-based iOS port of the turtle module (not 100% compatible with standard library | |
# turtle module, but most things beginners would use should work) | |
import ui | |
from math import * | |
import math | |
import time |
View Untitled_200.py
from objc_util import * | |
def foo_bar(_self,_cmd): | |
baz = 5 | |
return baz | |
foo_bar.encoding = 'l@:' | |
''' | |
first character is return type, then each argument, per encodings below. @ is objc object, : is selector. |
View multicb.py
import cb, threading | |
class Service(object): | |
'''wrapper for a cb.Service. Can index characteristics by | |
s[uuid] or s[index] | |
''' | |
def __init__(self,service): | |
self.primary=service.primary | |
self.uuid=service.uuid | |
self.characteristics={} |