Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmpc <jumapico@gmail.com>2010-03-21 12:47:14 (GMT)
committer jmpc <jumapico@gmail.com>2010-03-21 12:47:14 (GMT)
commit044d80b26637347d5cb5e56b8da74407127d600e (patch)
tree54faeaecfcb94aaca56418a56f4436022e35a7c2
parent0623bc950b887abe41f0599d34de1e5366465c7c (diff)
correct coordinate transformation in select
-rwxr-xr-xfracciones.activity/gtkcake.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/fracciones.activity/gtkcake.py b/fracciones.activity/gtkcake.py
index 8fc9fb5..24887c0 100755
--- a/fracciones.activity/gtkcake.py
+++ b/fracciones.activity/gtkcake.py
@@ -53,6 +53,7 @@ class Cake(gtk.DrawingArea):
def button_press(self, widget, event):
"""Manejador del evento button_press_event"""
+ print event.get_coords()
x, y = event.get_coords()
if self.select(x, y):
self.draw(widget.window.cairo_create())
@@ -129,8 +130,9 @@ class Cake(gtk.DrawingArea):
seleccionado, False en caso contrario."""
# Transformamos las coordenadas del usuario a coordenadas reales (0-1)
rect = self.get_allocation()
- wx = float(ux - rect.x) / float(rect.width)
- wy = float(uy - rect.y) / float(rect.height)
+ wx = float(ux) / float(rect.width)
+ wy = float(uy) / float(rect.height)
+ print rect, wx, wy
# Centramos
wx -= 0.5
wy -= 0.5