psychopy.org | Reference | Downloads | Github

Screenshot using getmovieframe how to get shot of both front and back screens

I am currently trying to get a screenshot of the fame of my movie with the circle I have drawn over the frame both in the screenshot. I have successfully gotten a frame of the movie using get movie frame and a screenshot of the circle I have drawn, but I am having trouble figuring out how to get them both in the same screenshot. The circle is in the back and the frame of movie is in the front. Is it possible to get screenshot of both buffers?

event.clearEvents()
circle= visual.Circle(win=mywin, units="pix",radius=15, fillColor=[-1,-1,-1], edges=128)
circle.pos = [Xpos[frame],Ypos[frame]]
circle.draw()

print ("Frame"), frame
print ("Resp"), resp[frame]
print ("Xpos"), Xpos[frame]
print ("Ypos"), Ypos[frame]
print ("xxxxx")

output = open("Encode_" + frameInfo[1] +"_to_"+frameInfo[2] + '.txt','w')
output.write("sequence ID:" + "\t" + frameInfo[0] + "\n")

for frame in range(int(frameInfo[1]),int(frameInfo[2])+1):
    output.write(str(frame)+ "\t"+str(Xpos[frame])+ "\t"+str(Ypos[frame])+"\t"+str(resp[frame])+"\n")
    #output.write(fnamelist2[tord[trial]] + "\t" + str(responses2[tord[trial]]) + "\t" + str(nmoves2[tord[trial]]) + "\n")
    mywin.getMovieFrame(buffer='back')
    file="screen"+str(frame)+".png"
    print file
    mywin.saveMovieFrames(file,clearFrames=False)
    print frame
output.close()

mywin.close()
core.quit()

I’ve edited your post but in the future please do this to show code properly:

Your code above doesn’t include anything related to showing a movie so it is hard to give more than general advice, which would be: draw the movie first, then the circle, and then call mywin.getMovieFrame(buffer='back') (or just mywin.getMovieFrame() if you have already done a myWin.flip()).

The order of drawing is important.

And don’t call saveMovieFrames on every frame. Just call it once when you’ve finished collecting them all (so outside the for loop)