aboutsummaryrefslogtreecommitdiff
path: root/examples/system
diff options
context:
space:
mode:
authormorefigs <morefigs@gmail.com>2019-01-30 15:12:13 +1100
committermorefigs <morefigs@gmail.com>2019-01-30 15:12:13 +1100
commit8001a079833ff96b855cb6f618b1c23a5b05ad7d (patch)
treec145667c5e9d32d90655689549d1072c0af1a61b /examples/system
parent87a55df00f138e0b3f5b8469c2a43f868704426c (diff)
parent7a915f3af6af7a3a8ef6c9d28aeb87392df3c8b4 (diff)
downloadpymba-8001a079833ff96b855cb6f618b1c23a5b05ad7d.tar.gz
pymba-8001a079833ff96b855cb6f618b1c23a5b05ad7d.zip
v0.2 to master
Diffstat (limited to 'examples/system')
-rw-r--r--examples/system/get_system_object.py8
-rw-r--r--examples/system/list_feature_values_and_ranges.py30
2 files changed, 38 insertions, 0 deletions
diff --git a/examples/system/get_system_object.py b/examples/system/get_system_object.py
new file mode 100644
index 0000000..2d59001
--- /dev/null
+++ b/examples/system/get_system_object.py
@@ -0,0 +1,8 @@
+from pymba import Vimba
+
+
+if __name__ == '__main__':
+
+ with Vimba() as vimba:
+ system = vimba.system()
+ print(system)
diff --git a/examples/system/list_feature_values_and_ranges.py b/examples/system/list_feature_values_and_ranges.py
new file mode 100644
index 0000000..ef4da34
--- /dev/null
+++ b/examples/system/list_feature_values_and_ranges.py
@@ -0,0 +1,30 @@
+from pymba import Vimba, VimbaException
+
+
+if __name__ == '__main__':
+
+ with Vimba() as vimba:
+ system = vimba.system()
+
+ # get feature value via feature object
+ for feature_name in system.feature_names():
+ feature = system.feature(feature_name)
+ try:
+ value = feature.value
+ range_ = feature.range
+
+ # 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
+ range_ = None
+
+ print('\n\t'.join(
+ str(x) for x in (
+ feature_name,
+ f'value: {value}',
+ f'range: {range_}')
+ if x is not None))