The X requires no change. Just flip and translate the Y.
On Fri, Oct 14, 2011 at 12:52 PM, craf <pyclut...@gmail.com> wrote: > Hi everyone! > > I'm trying to learn PyCairo, and using the following code, I created a > window with a scale of 200 x 200 > > > CODE:------------------------------------- > > #!/usr/bin/python > > import gtk > > > class Window(): > > def __init__(self): > > self.window = gtk.Window() > self.drwArea = gtk.DrawingArea() > > self.window.add(self.drwArea) > self.window.show_all() > > # Events----- > > self.drwArea.add_events(gtk.gdk.POINTER_MOTION_MASK) > > > # Signals----- > > self.window.connect("destroy", lambda e:gtk.main_quit()) > > self.drwArea.connect("expose-event", expose, self) > > self.drwArea.connect("motion-notify-event", motion_notify, > self) > > > def expose(widget, event, self): > > cr = widget.window.cairo_create() > > cr.scale(200,200) > > > def motion_notify(widget, event, self): > > print "x=%d y=%d" % (event.x, event.y) > > Window() > gtk.main() > > -CODE:--------------------------------------------------- > > The problem is the coordinate system, leaving the point (0.0) in: > > ______________________________ > |(0,0) | > | | > | | > | | > | | > | | > |______________________________| > > and I want to stay well: > > _______________________________ > | | > | | > | | > | | > | | > | | > |(0,0)_________________________| > > > I tested with cr.translate (-200, -200), but does not work. > > > I appreciate any suggestions. > > Regards. > > Craf. > > > DATES: > Python 2.6.4 > Ubuntu 9.10 > Gnome 2.28.0 > > _______________________________________________ > pygtk mailing list pygtk@daa.com.au > http://www.daa.com.au/mailman/listinfo/pygtk > Read the PyGTK FAQ: http://faq.pygtk.org/ > _______________________________________________ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/