moses-palmer / pynput

Sends virtual input commands
GNU Lesser General Public License v3.0
1.78k stars 247 forks source link

Update mouse-usage.rst because code produces error #587

Open TDHster opened 7 months ago

TDHster commented 7 months ago

Main problem was that event may not have attribute .button as the error indicates.

mouse.Events() can have 3 main types: pynput.mouse.Events.Click, pynput.mouse.Events.Move and pynput.mouse.Events.Scroll (as far as I know)

And among those three, last two of those do not have attribute .button surely.

So if we want to handle this problem, I guess we need to use exception handling.

https://stackoverflow.com/questions/73543563/attributeerror-move-object-has-no-attribute-button-mouse-listener-with-pyn