1
Python / How to display window in a separate thread/process?
« on: November 17, 2011, 08:30:02 pm »
Hi. I'm practicing with PySFML. I made a simple app that measures user response with a timer. To avoid mad refresh rate I enabled vertical sync. This is where the problems start. Without Vsync the results were accurate, but with Vsync on they are rounded according to the refresh rate of the screen. For example on my PC i keep getting results like 0,2333 second (14 / 60). This is because the window.display() function waits for the vertical sync and pauses the whole app. For me, this is unacceptable.
So there goes my question: How to move the display code to a separate thread or process? I read some tutorials on thread, threading and multiprocessing libraries, but they all seem to have a problem in accessing shared objects. I want to handle input and drawing in separate threads, and both reside in the same sf.window object. Is there a way to solve this?
Big thanks up front for help!
So there goes my question: How to move the display code to a separate thread or process? I read some tutorials on thread, threading and multiprocessing libraries, but they all seem to have a problem in accessing shared objects. I want to handle input and drawing in separate threads, and both reside in the same sf.window object. Is there a way to solve this?
Big thanks up front for help!