Created
March 4, 2010 14:47
-
-
Save hansent/321756 to your computer and use it in GitHub Desktop.
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
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()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment