python - Can I add pygame events from a second thread -


Well I have read in different places that the pygame event should be handled in the main thread. I want to do this but my question is, can I add events to a different thread in the event queue?

I want to call from pygame.event.post (myEvent) instead of handling the incident in a separate thread and main loop. Is this possible?

EDIT: To clarify, I will run a separate thread for asynchronous network I / O when a new message reaches the thread then there will be something to signal to an event in the event queue.

Time for some spy work! Looking at the source for

event_post , indicates that the C function uses SDL calls SDL_PushEvent , without checking thread for self-protection However, for this, the documentation says:

This function thread is secure, and can be safely said with another thread.

It seems that this is actually a safe thread.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -