0

Python pointer-1--drag event returns always <0,0>

Hi I am trying to catch the mouse pointer position from "pointer-1--drag" event, however the position() and relativePosition() events return always 0,0, this is a brief outline of my Python class:

 

class PyHello(rvtypes.MinorMode):
   
    def __init__(self):
        rvtypes.MinorMode.__init__(self)
        
        self.init("pyhello",
        [("pointer-1--drag", self.pointerMove, "My pointer move event")],
        None)
        
    def pointerMove(self, event):
        print "rel = %f %f" % (event.relativePointer()[0], event.relativePointer()[1])
        print "ptr = %f %f" % (event.pointer()[0], event.pointer()[1])

The result is always:

ptr = 0.000000 0.000000
rel = 0.000000 0.000000

I am using RV 3.12.13.

Any hint? Thank you,

Michele

6 条评论

  • 0
    Avatar
    Michele Bosi

    Alright, thank you Alan.

    Mic

  • 0
    Avatar
    Alan Trombla

    Hi Mechele,

    I'm afraid that looks like a bug.  I'm opening a support ticket for you, and I'll also update the forum when we figure this out.

    Thanks for the report !

    Alan

  • 0
    Avatar
    Alan Trombla

    Just to update the thread: yep, this was a bug.  Fixed now, and the fix will show up in the next release (RV 3.12.14).

    Cheers,

    Alan

  • 0
    Avatar
    Michele Bosi

    Great, thank you Alan,

    Mic

  • 0
    Avatar
    nicolas

    Hi Alan,

    iam trying to use this example as well to test some event binding.

     

    class PySideDockTest(rvtypes.MinorMode):

        def __init__(self):
          rvtypes.MinorMode.__init__(self)

          self.init("PySideDock", [("pointer-1--shift--push", self.pointerPush, "pointer-1--shift--push"),("pointer-1--shift--release", self.pointerRelease, "pointer-1--shift--release")], None)

       def pointerPush(self, event):
          print "push rel = %f %f" % (event.relativePointer()[0], event.relativePointer()[1])
          print "push ptr = %f %f" % (event.pointer()[0], event.pointer()[1])


       def pointerRelease(self, event):
          print "release rel = %f %f" % (event.relativePointer()[0], event.relativePointer()[1])
          print "release ptr = %f %f" % (event.pointer()[0], event.pointer()[1])

     

    With this example, shift+push event works and call pointerPush function, but when i shift+release it doesnt works.

    Any idea why ?

    terminal:

    push rel = 2147483904.000000 2147484160.000000
    push ptr = 230.000000 461.000000
    push rel = 2147483904.000000 2147483904.000000
    push ptr = 226.000000 369.000000
    push rel = 2147483904.000000 2147484160.000000
    push ptr = 290.000000 393.000000

     

  • 0
    Avatar
    nicolas

    ok i found out my mistake, i was missing a None, in my self.init. 

请先登录再写评论。