Skip to content
← Back to Community
Intermittent mouse coordinate bug using pygame zero
Profile icon
ChristopherBroo

Hello,

I have been testing out pygame zero functionality within repl.it for use with my class since we are running virtually and some of my students only have chromebooks. During my testing I have run into a rather strange intermittent bug.

The program is a very simple program - it's just pulling the mouse coordinates and using them to move a circle on screen. Oddly though sometimes when the program works as expected, but other times it will only get mouse coordinate values <= 99. Please see the following video for an example of this behaviour:

https://drive.google.com/file/d/1mW-tsEBOSGa9OjWQ8apHD6qPgaEPP5Nf/view
https://repl.it/@ChristopherBroo/mouse-coord-bug-pygame-zero#main.py

Any ideas folks?

Chris Brooks

Voters
Profile icon
ChristopherBroo
Comments
hotnewtop
Profile icon
MrSimonLowell

I just discovered this issue as well, just like yours the coordinates above 99 weren't recognized. Did you find a work around?

Profile icon
ChristopherBroo

@MrSimonLowell No, unfortunately I did not find a work around. I ended up using vanilla pygame instead with my class.

Profile icon
MrSimonLowell

@ChristopherBroo I might have figured something out. The repl.it I forked (and maybe you did too) wasn't using the current versions of Pygame, Pgzero and NumPy. I edited the file so that it installs the same versions that I get when I run pgzero locally on my Windows PC. I'm not sure that is the best solution, but it seemed to solve the mouse issue. Now I want to figure out why sounds.play() doesn't seem to work
image

Profile icon
ChristopherBroo

@MrSimonLowell Thanks a bunch. Updating to pygame version 2.0.1 fixes the issue!