moderngl / moderngl-window

A cross platform utility library for ModernGL making window creation and resource loading simple
MIT License
246 stars 61 forks source link

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

Closed PycraftDeveloper closed 2 years ago

PycraftDeveloper commented 2 years ago

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

einarf commented 2 years ago

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.

PycraftDeveloper commented 2 years ago

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

einarf commented 2 years ago

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.

PycraftDeveloper commented 2 years ago

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!

einarf commented 2 years ago

Should be fixed in 2.4.2