You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it be very tedios to exemplify setting a control's value when the type of the control within pyrav4l2 is a pyrav4l2 MenuItem and not a plain python type?
E.g. this way is obviously wrong:
frompyrav4l2importDevice, MenuItemdev=Device("/dev/video0")
ifdev.is_video_capture_capable:
forcindev.controls:
cv=dev.get_control_value(c)
ifisinstance(cv, MenuItem):
print(f'{c.name} is {cv.name} (a MenuItem)')
ifc.name=='LED1 Mode':
dev.set_control_value(c, MenuItem(cv.ctrl_id, cv.index, 'On'))
ifc.name=='LED1 Frequency':
dev.set_control_value(c, MenuItem(cv.ctrl_id, cv.index, '10 Hz'))
else:
print(f'{c.name} is {cv}')
The text was updated successfully, but these errors were encountered:
MenuItem is used for possible settings of Menu, so I'm assuming dev.controls contains a Menu object. This object contans .items which use the MenuItem class.
Please see this interactive example for reference:
I hope this helps! If in doubt, you can take a look at https://github.com/antmicro/pyvidctrl - this util utilizes pyrav4l2 quite extensively so should cover all possibilities
Would it be very tedios to exemplify setting a control's value when the type of the control within pyrav4l2 is a pyrav4l2 MenuItem and not a plain python type?
E.g. this way is obviously wrong:
The text was updated successfully, but these errors were encountered: