moderngl-window icon indicating copy to clipboard operation
moderngl-window copied to clipboard

Pygame2 error: 'Event' object has no attribute 'state'

Open PycraftDeveloper opened this issue 1 year ago • 1 comments

When using Pygame2 for the window class the error: 'Event' object has no attribute 'state' occurs.

This is because in 'window.py' in the 'pygame2' folder; found here: https://github.com/moderngl/moderngl-window/blob/master/moderngl_window/context/pygame2/window.py line 285 is causing problems, there is no attribute 'state' in the 'event' object.

Without knowing its exact function, simply commenting it out fixes the problem and using Pygame2 for the window class works fine again.

Untitled2

download2

download3

PycraftDeveloper avatar Aug 11 '22 11:08 PycraftDeveloper

What pygame version are you using? It was originally created for a dev release of 2.0 so we might need to bump that one.

einarf avatar Aug 13 '22 15:08 einarf

I am using Pygame version: 2.1.2, I hope that helps!

PycraftDeveloper avatar Aug 17 '22 12:08 PycraftDeveloper

Right. I made this window backend back in 2.0.0dev days and it probably needs some updating. I didn't know there was breaking changes in events.

einarf avatar Aug 17 '22 21:08 einarf

Ah ok, it doesn't look too challenging to fix, I was able to work around it by simply commenting out a small section of code to fix the error, but that isn't probably an ideal solution! Hopefully this isn't a difficult fix, thanks also for the quick response!

PycraftDeveloper avatar Aug 20 '22 10:08 PycraftDeveloper

Should be fixed in 2.4.2

einarf avatar Sep 17 '22 17:09 einarf