Guest User

Untitled

a guest
May 20th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. def draw_connection_in_progress(touch):
  2. drawLine([touch.userdata['connection_start'], touch.pos])
  3.  
  4. class ConnectionButton(MTWidget):
  5. instances = []
  6.  
  7. def __init__(self, **kwargs):
  8. super().__init__(**kwargs)
  9. ConnectionButton.instances.append(self)
  10.  
  11. def check_connection(self, touch):
  12. for target in ConnectionButton.instances:
  13. if target.coolide_point(*touch.pos):
  14. self.connect(target)
  15.  
  16. def on_touch_down(self, touch):
  17. touch.userdata['connection_start'] = self.to_window(*self.pos)
  18. touch.push_handler(draw=draw_connection_in_progress)
  19. touch.push_handler(up=self.check_connection())
Add Comment
Please, Sign In to add comment