psychopy.org | Reference | Downloads | Github

Does Psychopy support multithread programming in Python

I would like to control Psychopy routines from a behavioral program (for non-human primates, written in C++). One likely reasonable way to do so involves communicating from the C++ program using TCP-IP. On the Psychopy side, handling the TCP inputs would likely require a dedicated thread distinct from the control thread running the body of the Psyshopy routine. The TCP-handling thread would control the main Pyshopy thread.

Is such an architecture reasonable to implement in Pychopy?

Thanks
Aniruddha

You might not need that level of complication. So perhaps it might be useful to specify what you need to do, before getting advice on a multi threading approach to doing it.

eg if you want PsychoPy to update stimuli based on TCP/IP messages, there is no need to be checking for such messages more than once per screen refresh. Hence, such code could just be integrated in your main drawing cycle loop and not require any mucking around with threads or multiprocessing at all.

Thanks. Your point is well taken. For now my programs can remain synchronized to the display frame rate and should not need multithreading.

Best
Aniruddha