Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Untitled_5.py
import ui
class PointShowingView(ui.View):
def __init__(self,*args,**kwargs):
ui.View.__init__(self,*args,**kwargs)
self.p=(150,150)
self.color=(0.5,0.5,.5)
def draw(self):
ui.set_color(self.color)
ui.Path.rect(*self.p,100,100).fill()
def touch_moved(self,touch):
self.p=touch.location
sv=self.superview
while sv:
sv.p=ui.convert_point(self.p,self,sv)
self.set_needs_display()
sv.set_needs_display()
sv=sv.superview
v=PointShowingView(frame=(0,0,500,500),bg_color=(.5,1,1))
v.alpha=1
s=PointShowingView(frame=(100,100,300,300), bg_color='green')
v.add_subview(s)
t=PointShowingView(frame=(100,100,200,200), bg_color='red')
s.alpha=0.5
t.alpha=.5
s.transform=ui.Transform.concat(ui.Transform.scale(1.2,1.1), ui.Transform.translation(50,25)).concat(ui.Transform.rotation(25))
t.transform=ui.Transform.rotation(25)
s.add_subview(t)
#v.p=ui.convert_point(s.p,s,v)
def test():
v.present('sheet')
test()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.