I’m trying to write an experiment using python idle. display.update() in pygame can update only part of the win instead of the whole win(display.flip()). But how to use psychopy to achieve this update function? When I set the clearBuffer in win.flip() to False according to the psychopy manual, I didn’t achieve the effect I wanted.Looking forward to your response. Thanks a lot.
The best option is generally to just redraw everything anyway, even the things that haven’t changed. Would that not work?
This works, but since I only want to change just a small part of the stimulus each time I filip, redrawing it would make my code redundant.
In fact I wanted to write a program that would enable an online game for 7 players, where at the beginning of the program, each of the 7 players would select their avatar (choose their avatar). The screen will be updated once each player has made his choice.
Could you give some advice?
“Online game” is already a challenging thing to do in PsychoPy. If you’re talking about a game with 7 players each on their own computer connected to a network, that would be extremely challenging to implement.
That aside, yes you will have some redundancy in your code. However, you can create a simple function that will make things easier from a programming perspective.
def drawAll(): # Put all of the draw() calls for your stimuli here win.flip()
Then you can update the properties of any objects you want and just call drawAll(), and it will always draw everything for you without you having to list them all every time.
Is it possible to use pygame to achieve this effect more easily?
Which part? If you want to use PsychoPy stimulus objects, the answer is “no” regardless.
If you’re talking about implementing an online game, the main issue is that you need some system that communicates between players, which is not something PsychoPy supports by default, and in general network code like that is a challenging problem. I’m afraid I don’t have any good advice about how to do that because I’ve never tried, but there are existing tools like oTree which might be useful starting points: oTree—An open-source platform for laboratory, online, and field experiments - ScienceDirect
Have you investigated the shelf? That is the route for communication between participants in PsychoPy.