Skip to content

Instantly share code, notes, and snippets.

import scene
import copy
import math
import ui
class Paddle(scene.ShapeNode):
def __init__(self, x, y, parent=None):
path = ui.Path.rect(0,0, 40, 200)
super(Paddle, self).__init__(path, position=(x, y), fill_color='green', parent=parent)
self.touch = None
# coding: utf-8
import scene
import ui
from PIL import Image as PILImage
class MyScene (scene.Scene):
def setup(self):
self.im = PILImage.open('tunnelswirl.gif')
self.mypalette = self.im.getpalette()
self.savefile = 'tmp.png'
# Sharing pyui file is simplified by the following omz's script.
# https://forum.omz-software.com/topic/2905/helper-script-for-embedding-pyui-files-in-single-file-scripts
# This may be good enough if users just want to run the script.
# But if they want to see or edit the .pyui file, it would be helpful
# to generate the .pyui file. This script does this geneartion.
# This script extracts the encoded string, decode it and
# generate the .pyui file. Like the embedpyui script,
# this needs to be added to editor actions (wrench) menu.
#
import scene, ui
shadercode_text = '''
// Modified Mandelbrot code from shadertoy.com
// https://www.shadertoy.com/view/XdtSRN
// used make_color function from ccc (pythonista forum)
// https://github.com/cclauss/fractal_hacks/blob/master/cc_mandelbrot.py
precision highp float;
varying vec2 v_tex_coord;