summaryrefslogtreecommitdiff
path: root/host/inter
diff options
context:
space:
mode:
authorNicolas Schodet2008-04-26 08:08:00 +0200
committerNicolas Schodet2008-04-26 08:08:00 +0200
commit5095f2b51b3452b41d40342bcb5b772e6237a13e (patch)
treefa33924af32f782934afd7a26b1d15db096e5d51 /host/inter
parent31396a571a8ce6569a73bab4247aa4af6e4b1fed (diff)
* host/inter:
- added function to compute position from mouse click.
Diffstat (limited to 'host/inter')
-rw-r--r--host/inter/drawable.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/host/inter/drawable.py b/host/inter/drawable.py
index b7ffbc02..26628f40 100644
--- a/host/inter/drawable.py
+++ b/host/inter/drawable.py
@@ -164,3 +164,9 @@ class DrawableCanvas(Tkinter.Canvas):
return [ (i[0] * self.__scale + self.__xoffset,
-i[1] * self.__scale + self.__yoffset) for i in args ]
+ def screen_coord (self, screen):
+ """Return drawable coordinates corresponding to the given screen
+ coordinates."""
+ return ((self.canvasx (screen[0]) - self.__xoffset) / self.__scale,
+ -(self.canvasy (screen[1]) - self.__yoffset) / self.__scale)
+