-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add timeout parameter while waiting for events #202
Comments
Original comment by metagriffin (Bitbucket: metagriffin, GitHub: metagriffin): i created a pull request #31 to provide an implementation. |
I've linked the original pull request for this since the https://bitbucket.org/pygame/pygame/pull-requests/31/add-timeout-parameter-while-waiting-for/diff I'm still a little lost on the use cases myself, even after reading the bitbucket thread. |
This was started back on bitbucket with the use case suggested of a clock that updates the screen when a hand moves or, I guess, when the user prods it some way. |
Wouldn't it be better (more reliable/simpler) to use a timer for this? |
We now have a timeout parameter for |
I’ll probably try adding the timeout parameter to the fastevent.wait method |
I'm not sure if fastevent is relevant anymore on SDL2. I'm pretty sure the new event loop is very fast with mulitple threads posting now... but haven't confirmed. |
Hmm, so close this issue? |
Originally reported by: metagriffin (Bitbucket: metagriffin, GitHub: metagriffin)
i think it would be great if the wait functions (
pygame.event.wait
andpygame.fastevent.wait
) could accept a timeout parameter -- this would alleviate the need to duplicate a lot of code that uses the poll/sleep approach to reduce CPU consumption.To Do to resolve:
pygame.event.wait()
after which time it will return True even if the event has not yet occurred.pygame.fastevent.wait()
after which time it will return True even if the event has not yet occurred.Related Docs: https://www.pygame.org/docs/ref/event.html#pygame.event.wait
The text was updated successfully, but these errors were encountered: