I would like to setup a pygame app from ipython in a background thread.
I already tried to import pygame from this thread before importing it anywhere else.
The problem is that when I launch my main loop inside this thread, soon, it gets frozen until I press enter in the interpreter.
How could I always keep it running ?
Note : that when starting a dummy thread that just print stuffs, it doesn't get blocked, so I think it's more related to pygame than to ipython or python interpreter. The same behaviour appears in IPython and regular python interpreter
I just built an example of this for my own project!
I'm not sure what caused yours to freeze, though I know for mine the OS kept trying to force it to close until I started actually processing the events from the event queue - apparently when the queue filled up the OS thought my thread was broken.
Here's the basic idea below, though you can find my slightly more detailed example, with more comments and with example instances to use, Here on GitHub.