Hello,
in Version 3.3.7313 (64Bit) following script is not working:
Time_List = [SharpCap.SelectedCamera.Controls[17].Value]
-->Traceback (most recent call last):
File "<string>", line 15, in <module>
TypeError: 'Controls' object is not subscriptable
In Version 3.2 it's working.
Best regards
Sven
Script error
- admin
- Site Admin
- Posts: 13296
- Joined: Sat Feb 11, 2017 3:52 pm
- Location: Vale of the White Horse, UK
- Contact:
Re: Script error
Hi Sven,
I found some error cases when testing that cause problems due to the contents of the control list being changed while the software was looking for a particular control. To avoid that being a problem in future I ended up removing the ability to access the controls by index. It's probably a bad practice anyway since the index number may change in different versions of SharpCap as new features are added.
Please try using
Controls.FindByName('name')
Controls.FindById(id)
Controls.Find(lambda x: .....)
These are all implemented in a way that is safe against problems caused by the list of controls changing.
cheers,
Robin
I found some error cases when testing that cause problems due to the contents of the control list being changed while the software was looking for a particular control. To avoid that being a problem in future I ended up removing the ability to access the controls by index. It's probably a bad practice anyway since the index number may change in different versions of SharpCap as new features are added.
Please try using
Controls.FindByName('name')
Controls.FindById(id)
Controls.Find(lambda x: .....)
These are all implemented in a way that is safe against problems caused by the list of controls changing.
cheers,
Robin
Re: Script error
Hi Robin,
have a example? I'm a newcomer with Python.
I can read the Exposuretime now: SharpCap.SelectedCamera.Controls.Exposure.Value
but how I can read (or write) the start (end) calibration?
thanks! Sven
have a example? I'm a newcomer with Python.
I can read the Exposuretime now: SharpCap.SelectedCamera.Controls.Exposure.Value
but how I can read (or write) the start (end) calibration?
thanks! Sven
- admin
- Site Admin
- Posts: 13296
- Joined: Sat Feb 11, 2017 3:52 pm
- Location: Vale of the White Horse, UK
- Contact:
Re: Script error
Hi Sven,
cheers,
Robin
Code: Select all
print SharpCap.SelectedCamera.Controls.FindByName('Calibration Start Pos Adjust').Value
SharpCap.SelectedCamera.Controls.FindByName('Calibration Start Pos Adjust').Value = 1234
Robin
Re: Script error
Hi Robin,
thanks, now I understand this.
cheers Sven
thanks, now I understand this.
cheers Sven