@@ -77,7 +77,7 @@ def release(self, buttons):
7777 """Release the given mouse buttons.
7878
7979 :param buttons: a bitwise-or'd combination of ``LEFT_BUTTON``, ``MIDDLE_BUTTON``, and ``RIGHT_BUTTON``.
80- """
80+ """
8181 self .report [0 ] &= ~ buttons
8282 self .move (0 , 0 , 0 )
8383
@@ -104,31 +104,35 @@ def click(self, buttons):
104104 self .press (buttons )
105105 self .release (buttons )
106106
107- def move (self , x_distance , y_distance , wheel_turn ):
107+ def move (self , x = 0 , y = 0 , wheel = 0 ):
108108 """Move the mouse and turn the wheel as directed.
109109
110- :param x_distance : Move the mouse along the x axis. Negative is to the left, positive is to the right.
111- :param y_distance : Move the mouse along the y axis. Negative is toward the user , positive is away from the user .
112- :param wheel turn : Rotate the wheel this amount. Negative is toward the user, positive is away from the user.
110+ :param x : Move the mouse along the x axis. Negative is to the left, positive is to the right.
111+ :param y : Move the mouse along the y axis. Negative is upwards on the display , positive is downwards .
112+ :param wheel: Rotate the wheel this amount. Negative is toward the user, positive is away from the user. The scrolling effect depends on the host .
113113 :raises ValueError: if any argument is not in the range -127 to 127 inclusive.
114114
115115 Examples::
116116
117- # Move 100 to the left.
117+ # Move 100 to the left. Do not move up and down. Do not roll the scroll wheel.
118118 m.move(-100, 0, 0)
119+ # Same, with keyword arguments.
120+ m.move(x=-100)
119121
120122 # Move diagonally to the upper right.
121- m.move(50, 20, 0)
123+ m.move(50, 20)
124+ # Same.
125+ m.move(x=50, y=-20)
122126
123127 # Roll the mouse wheel away from the user.
124- m.move(0, 0, 5 )
128+ m.move(wheel=1 )
125129 """
126- if (self ._distance_ok (x_distance )
127- and self ._distance_ok (y_distance )
128- and self ._distance_ok (wheel_turn )):
129- self .report [1 ] = x_distance
130- self .report [2 ] = y_distance
131- self .report [3 ] = wheel_turn
130+ if (self ._distance_ok (x )
131+ and self ._distance_ok (y )
132+ and self ._distance_ok (wheel )):
133+ self .report [1 ] = x
134+ self .report [2 ] = y
135+ self .report [3 ] = wheel
132136 self .hid_mouse .send_report (self .report )
133137 else :
134138 raise ValueError ('All arguments must be >= -127 and <= 127' )
0 commit comments