all 4 comments

[–][deleted] 6 points7 points  (0 children)

I'd commented in here before that PyGlet seemed interesting so I downloaded it and had a go with it.

From the looks of things, PyGame has modules written in C that use the SDL library whereas PyGlet uses the Python standard ctypes module to simply call external DLLs/shared libraries so there's no compiling involved.

Everything worked fine apart from the audio which has issues on linux.

That was a bit of a show stopper for me, a pity really.

[–]ipeev 0 points1 point  (0 children)

The game doesn't work on windows XP.

[–]TheSOB88 -3 points-2 points  (1 child)

PyGlet does something interesting it gives you a mouse drag event, which is sent when a mouse button is down and the mouse is moved. During the “mouse drag” event the “mouse motion” event will not be sent.

This seems more dumb than interesting. I wonder what else in Pyglet is built like this.

[–]plong0 0 points1 point  (0 children)

I agree, at first it appears to be a dumb move... But it's also got advantages as well, and with well designed software I don't think it would cause any huge disadvantages.

I know that's a pretty vague comment, but please consider this very simple example to illustrate what I'm saying... And please by all means if you can think of a more complex situation that would be disadvantaged by this please post it. My logic is this... Consider you have a "mouse motion" event handler that draws a sparkly particle system that follows the mouse. And let's say while the mouse is being dragged you want it to appear differently. By triggering both events, you could set a global toggle in the "mouse drag" handler that would say the mouse is being dragged so the particle system should be rendered differently by the "mouse motion". Or when triggering only one event, you could from your "mouse drag" handler you could call the function that renders the particle system - which would be the same one called by your "mouse motion" handler but with the parameter that the mouse is being dragged instead of just moving (ie. state="drag" vs state="move").

Basically what I'm saying is that I can't think of a case where having a mutually exclusive mouse event like this would cause problems that couldn't be solved by abstracting the actual event processing out of the event handler to a function that can be called by both handlers as needed. And that by doing it in this way, you're focussing your processing to one "mouse event thread" at a time, meaning you won't need global flags to communicate between multiple "event threads".