SavinaRoja/PyUserInput

Mouse click does not activate other windows

sajja opened this issue · 0 comments

sajja commented

Trying to listen to mouse event ,if clicked I'm trying to move the mouse to different location and emit another mouse event. it does not seem to work.
Mouse correctly moves to specified location. But click event does not bring up the background window to foreground.

My code as follows


from pymouse import PyMouseEvent
from pymouse import PyMouse
from pykeyboard import PyKeyboard
from pykeyboard import PyKeyboardEvent

class Clickonacci(PyMouseEvent):
    def __init__(self):
        PyMouseEvent.__init__(self)

    def click( self, x, y, button, press):
        m = PyMouse()   
        if button == 2:
            if press:
                print x,y
                m.move(1283,515)
                m.click(1283,515,1)
            else:
                print "other"

C = Clickonacci()
C.run()

Environment

Linux/Ubuntu
Python 2.7.6

Thanks.
Sajith