brython-dev / brython

Brython (Browser Python) is an implementation of Python 3 running in the browser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

event.buttons is always 1 in mousemove event, even if no button is pressed

jibalamy opened this issue · comments

Hello,

In mousemove event, event.buttons is always 1, even if no button is pressed.

In the following code, I see only "1" in the console when moving the mouse around without pressing button. I tested it with FireFox and Chrome.

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript" src="brython.js"></script>
<script type="text/javascript" src="brython_stdlib.js"></script>
</head>

<body>
<script type="text/python">
from browser import document

document <= "Hello"

def on_mousemove(event):
  print(event.buttons)
document.bind("mousemove", on_mousemove)
    
  
</script></body></html>

Sorry, I can't reproduce the bug. The code shows 0 when moving the mouse without pushing any button, 1 when pushing the left button, 3 when pushing left and right at the same time, etc. Tested on Chrome and Firefox.

After rebooting my computer, the problem disappeared.
Sorry for that :-(