Ask coding questions

← Back to all posts
Intermittent mouse coordinate bug using pygame zero
ChristopherBroo (0)

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

Comments
hotnewtop
MrSimonLowell (0)

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

ChristopherBroo (0)

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

MrSimonLowell (0)

@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