Example #1
0
    def start(self):
        """Start pyhk to check for hotkeys"""
        with mouseListener(on_move=self.onMouseMove,
                           on_scroll=self.onMouseScroll,
                           on_click=self.OnMouseClick) as self.mouselistener:

            with keyboardListener(on_press=self.OnKeyDown,
                                  on_release=self.OnKeyUp) as \
                    self.keyboardlistener:

                self.mouselistener.join()
                self.keyboardlistener.join()
Example #2
0
 def start_mouse_listener(self):
     with mouseListener(on_move=None,
                        on_click=self.on_mouse_click,
                        on_scroll=None) as listener:
         listener.join()
Example #3
0
def MouseListener():
    with mouseListener(
            on_click=MouseOnClick, on_move=MouseOnMove
    ) as listener:  #(on_move=on_move, on_click=on_click, on_scroll=on_scroll)
        listener.join()
Example #4
0
def on_move(x, y):
    logging.info("{},{},{},{}".format('MOUSE_MOVEMENT', x, y, None))
    print("Mouse moved position ({},{})".format(x, y))


def on_click(x, y, button, pressed):
    print("Mouse Position : {}".format((x, y)))
    logging.info("{},{},{},{}".format('MOUSE_CLICK', x, y, button))
    print("Mouse clicked button:{}".format(button))


def on_scroll(x, y, dx, dy):
    # screen(path_)
    print("Mouse Scrolling {}".format((x, y)))
    print("Mouse scrolled with ({},{})".format(dx, dy))


if __name__ == "__main__":

    path_ = input("Enter the path")
    p1 = Process(target=screen, args=(path_, ))
    m = mouseListener(on_move=on_move, on_click=on_click, on_scroll=on_scroll)
    k = keyboardListener(on_press=on_press, on_release=on_release)
    m.start()
    k.start()
    p1.start()
    m.join()
    k.join()
    p1.join()
Example #5
0
        img = ImageGrab.grab()
        send_data(img, conn[4])


if __name__ == '__main__':
    sock = [
        socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) for i in range(5)
    ]
    conn = []
    addr = []
    for s in sock:
        s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        s.bind((HOST, PORT))
        s.listen()
        c, a = s.accept()
        conn.append(c)
        addr.append(a)
        PORT += 1
    print(len(pickle.dumps(ImageGrab.grab())))
    for a in addr:
        print(a)
    m = mouseListener(on_move=on_move, on_click=on_click)
    k = keyboardListener(on_press=on_press, on_release=on_release)
    sc = Process(target=screen_frame, args=(conn, ))
    k.start()
    m.start()
    sc.start()
    m.join()
    k.join()
    sc.join()
Example #6
0
        print(key)
        save_screenshot(gameName, x, y, key, box)


def on_click(x, y, button, pressed):
    if d3Window[0][1][0] <= x <= d3Window[0][1][0] + d3Window[0][2][0] and \
            d3Window[0][1][1] <= y <= d3Window[0][1][1] + d3Window[0][2][1] and pressed:
        if button == "Button.left":
            key = 'left'
        else:
            key = 'right'
        save_screenshot(gameName, x, y, key, box)


k_listener = keyboardListener(on_press=on_press)
m_listener = mouseListener(on_click=on_click)

for i in range(3):
    print(3-i)
    time.sleep(.5)
print("Starting to listen....")


m_listener.start()
k_listener.start()

time.sleep(10)

m_listener.stop()
k_listener.stop()
print("stopped")