SavinaRoja / PyUserInput

A module for cross-platform control of the mouse and keyboard in python that is simple to install and use.
GNU General Public License v3.0
1.07k stars 244 forks source link

scroll event issue #101

Open jcyc opened 6 years ago

jcyc commented 6 years ago

Hi and thanks for this project :)

I try coding to record mouse event ,the code like below:

class event(PyMouseEvent):

    def __init__(self):
        super(event, self).__init__()
    def move(self, x, y):
        print('{ "event": "move", "x": "' + str(x) + '", "y": "' + str(y) + '"}')
    def scroll(self, vertical, horizontal, depth):
        print('{ "event": "scroll", "vertical": "'+str(vertical)+',"horizontal": "'+str(horizontal)+',"depth": "'+str(depth))`

and when I build and try move and scroll, return error like this:

`File "build/bdist.linux-x86_64/egg/pymouse/x11.py", line 214, in handler 

 self.scroll(event.root_x, event.root_y, *button_code_to_scroll_direction(event.detail))TypeError: scroll() takes exactly 4 arguments (5 given)`

my develop env. is ubuntu 16.04 / py 2.7 then try fix it , if I fix the PyUserInput-master/pymouse/x11.py, line 212 from

self.scroll(event.root_x, event.root_y, *button_code_to_scroll_direction(event.detail))

to

self.scroll(event.root_x, event.root_y, button_code_to_scroll_direction(event.detail))

the python script will work fine,if don't remove this ' * ' ,I think function will receive a tube input , then function will not work , I don't know anyone have same issue?

thanks again~