Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def draw_connection_in_progress(touch):
- drawLine([touch.userdata['connection_start'], touch.pos])
- class ConnectionButton(MTWidget):
- instances = []
- def __init__(self, **kwargs):
- super().__init__(**kwargs)
- ConnectionButton.instances.append(self)
- def check_connection(self, touch):
- for target in ConnectionButton.instances:
- if target.coolide_point(*touch.pos):
- self.connect(target)
- def on_touch_down(self, touch):
- touch.userdata['connection_start'] = self.to_window(*self.pos)
- touch.push_handler(draw=draw_connection_in_progress)
- touch.push_handler(up=self.check_connection())
Add Comment
Please, Sign In to add comment