Created
March 9, 2018 06:42
-
-
Save jsbain/6dacbc24e874bf4458772cc4a2bc4aad to your computer and use it in GitHub Desktop.
Untitled_188.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 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