diff options
| author | morefigs <morefigs@gmail.com> | 2019-01-29 10:18:57 +1100 |
|---|---|---|
| committer | morefigs <morefigs@gmail.com> | 2019-01-29 10:18:57 +1100 |
| commit | 220fd5201be8d1a149abcf1637ed8bcc04123dfe (patch) | |
| tree | cceb57ce76da1f15e08a82ceb10ef7e8ecb8cfa7 /examples | |
| parent | ed8292a1427a422770c983bace843520b5da46a7 (diff) | |
| download | pymba-220fd5201be8d1a149abcf1637ed8bcc04123dfe.tar.gz pymba-220fd5201be8d1a149abcf1637ed8bcc04123dfe.zip | |
added new usage examples
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/get_camera_feature_infos.py | 14 | ||||
| -rw-r--r-- | examples/get_camera_feature_values.py | 27 | ||||
| -rw-r--r-- | examples/get_interface_feature_infos.py | 14 | ||||
| -rw-r--r-- | examples/get_system_feature_values.py | 24 | ||||
| -rw-r--r-- | examples/set_camera_feature_value.py | 18 | ||||
| -rw-r--r-- | examples/set_interface_feature_value.py | 19 |
6 files changed, 116 insertions, 0 deletions
diff --git a/examples/get_camera_feature_infos.py b/examples/get_camera_feature_infos.py new file mode 100644 index 0000000..78e2752 --- /dev/null +++ b/examples/get_camera_feature_infos.py @@ -0,0 +1,14 @@ +from pymba import Vimba + + +if __name__ == '__main__': + + with Vimba() as vmb: + camera = vmb.camera(0) + camera.open() + + for feature_name in camera.feature_names(): + feature = camera.feature(feature_name) + print(feature.info) + + camera.close() diff --git a/examples/get_camera_feature_values.py b/examples/get_camera_feature_values.py new file mode 100644 index 0000000..89f1582 --- /dev/null +++ b/examples/get_camera_feature_values.py @@ -0,0 +1,27 @@ +from pymba import Vimba, VimbaException + + +if __name__ == '__main__': + + with Vimba() as vmb: + camera = vmb.camera(0) + camera.open() + + # get feature value via feature object + for feature_name in camera.feature_names(): + feature = camera.feature(feature_name) + + try: + value = feature.value + + # alternatively the feature value can be read as an object attribute + # value = getattr(camera, feature_name) + # or + # value = camera.someFeatureName + + except VimbaException as e: + value = e + + print(feature_name, '--', value) + + camera.close() diff --git a/examples/get_interface_feature_infos.py b/examples/get_interface_feature_infos.py new file mode 100644 index 0000000..8330a3d --- /dev/null +++ b/examples/get_interface_feature_infos.py @@ -0,0 +1,14 @@ +from pymba import Vimba + + +if __name__ == '__main__': + + with Vimba() as vmb: + interface = vmb.interface(0) + interface.open() + + for feature_name in interface.feature_names(): + feature = interface.feature(feature_name) + print(feature.info) + + interface.close() diff --git a/examples/get_system_feature_values.py b/examples/get_system_feature_values.py new file mode 100644 index 0000000..c83f292 --- /dev/null +++ b/examples/get_system_feature_values.py @@ -0,0 +1,24 @@ +from pymba import Vimba, VimbaException + + +if __name__ == '__main__': + + with Vimba() as vmb: + system = vmb.system() + + # get feature value via feature object + for feature_name in system.feature_names(): + feature = system.feature(feature_name) + + try: + value = feature.value + + # alternatively the feature value can be read as an object attribute + # value = getattr(system, feature_name) + # or + # value = system.someFeatureName + + except VimbaException as e: + value = e + + print(feature_name, '--', value) diff --git a/examples/set_camera_feature_value.py b/examples/set_camera_feature_value.py new file mode 100644 index 0000000..a33bf88 --- /dev/null +++ b/examples/set_camera_feature_value.py @@ -0,0 +1,18 @@ +from pymba import Vimba + + +if __name__ == '__main__': + + with Vimba() as vmb: + camera = vmb.camera(0) + camera.open() + + # set a feature value by feature name + feature = camera.feature('ExposureAuto') + print(feature.value) + feature.value = feature.value + + # alternatively the feature value can be set as an object attribute + camera.ExposureAuto = feature.value + + camera.close() diff --git a/examples/set_interface_feature_value.py b/examples/set_interface_feature_value.py new file mode 100644 index 0000000..0fc80a2 --- /dev/null +++ b/examples/set_interface_feature_value.py @@ -0,0 +1,19 @@ +from pymba import Vimba + + +if __name__ == '__main__': + + with Vimba() as vmb: + interface = vmb.interface(0) + interface.open() + + # set a feature value by feature name + feature = interface.feature('InterfacePingPace') + print(feature.value) + feature.value = 3 + print(feature.value) + + # alternatively the feature value can be set as an object attribute + interface.InterfacePingPace = 3 + + interface.close() |
