I want to access different modules using a for loop in PySpin Library Python. For example, to change the values of Exposure time and Frame Rate of the camera, you can use camera.ExposureTime.SetValue(1000) and camera.AcquisitionFrameRate.SetValue(5).The main idea is to replace those values using an array instead.
try:
result = True
cam.ExposureAuto.SetValue(PySpin.ExposureAuto_Off)
for i in item:
if i[1] is not None:
if cam.i[0].GetAccessMode() != PySpin.RW:
return {"message": "Unable to set {i[0]}"}
cam.i[0].SetValue[i[1]]
In this case, I get the error below : TypeError: 'CameraPtr' object is not subscriptable
Can anyone help please? Thanks a lot !!!
You could set up your own array, if you really want to do this, by doing:
camidx = [
cam.Exposure,
cam.ExposureAuto,
cam.Brightness
]
Now you can write camidx[0].SetValue(7)
. I'm not convinced that's better.