Export the print screen image from python step by step

does anyone know python code that could export the printscreen image in python process show the step by step of python that could be used for animation.

You could just script the -ViewCaptureToFile command with rs.Command in a loop. Something like the following which will make n number of frames of moving an object along a curve:

import rhinoscriptsyntax as rs

obj=rs.GetObject("Pick object to move")
crv=rs.GetObject("Pick path curve to follow",4)
folder=rs.BrowseForFolder(message="Choose folder for images")
frames=rs.GetInteger("Number of frames?")

#view size
vWidth=800 ; vHeight=600

#command option string
opts=" _Width="+str(vWidth)+" _Height="+str(vHeight)+" _Scale=1 _DrawGrid=_No "
opts+="_DrawWorldAxes=_No _DrawCPlaneAxes=_No _TransparentBackground=_No _Enter"

rs.HideObject(crv) #to not show path curve in image
for i in range(frames):
    rs.Command("-_ViewCaptureToFile "+folder+"\\FrameNumber_"+str(i)+".jpg"+opts)