Skip to content

Instantly share code, notes, and snippets.

@jsbain
Created March 9, 2018 06:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsbain/6dacbc24e874bf4458772cc4a2bc4aad to your computer and use it in GitHub Desktop.
Save jsbain/6dacbc24e874bf4458772cc4a2bc4aad to your computer and use it in GitHub Desktop.
Untitled_188.py
import scene,ui,math
class MyScene(scene.Scene):
def update(self):
t=self.t
self.background_color = ((0.5*t)%1.,
math.sin(.5*t)+0.5,
math.sin(1/3.*t)**2,
1)
v=ui.View()
b=ui.Button(title='Play')
b.background_color='#eeeeee'
b.frame=(0,200,100,44)
b.corner_radius=20
sv=scene.SceneView()
sv.frame=(0,0,200,200)
scn=MyScene()
sv.scene=scn
sv.paused=True
v.sv=sv
def toggle(sender):
sender.title= sender.superview.sv.paused*'Pause' + (not sender.superview.sv.paused)*'Play'
sender.superview.sv.paused= not sender.superview.sv.paused
b.action=toggle
v.add_subview(b)
v.add_subview(sv)
v.bg_color='white'
v.present()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment