aboutsummaryrefslogtreecommitdiff
path: root/examples/interface/list_feature_values_and_ranges.py
blob: c07bec3ddd7199586283de8a95ad708eeff9dccc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from pymba import Vimba, VimbaException


if __name__ == '__main__':

    with Vimba() as vimba:
        interface = vimba.interface(0)
        interface.open()

        # get feature value via feature object
        for feature_name in interface.feature_names():
            feature = interface.feature(feature_name)
            try:
                value = feature.value
                range_ = feature.range

                # alternatively the feature value can be read as an object attribute
                # value = getattr(interface, feature_name)
                # or
                # value = interface.someFeatureName

            except VimbaException as e:
                value = e
                range_ = None

            print('\n\t'.join(
                str(x) for x in (
                    feature_name,
                    'value: {}'.format(value),
                    'range: {}'.format(range_))
                if x is not None))

        interface.close()