From 5095f2b51b3452b41d40342bcb5b772e6237a13e Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Sat, 26 Apr 2008 08:08:00 +0200 Subject: * host/inter: - added function to compute position from mouse click. --- host/inter/drawable.py | 6 ++++++ 1 file changed, 6 insertions(+) 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) + -- cgit v1.2.3