Created
February 2, 2019 04:38
-
-
Save jsbain/040a32c7b8bd90611113065dd4dd194f to your computer and use it in GitHub Desktop.
Untitled_5.py
This file contains hidden or 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 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