-
import winrt.windows.devices.sensors as ds
als = ds.LightSensor.get_default()
lux = als.get_current_reading()
x = lux.properties.lookup("{C458F8A7-4AE8-4777-9607-2E9BDD65110A} 62")
print(x) ---> **problem , <_winrt._winrt_base object at 0x0000023045BC4D10> , not able to obtain value** From https://github.com/tpn/winsdk-10/blob/master/Include/10.0.16299.0/shared/sensorsdef.h |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Python tip: you can use Python subscript expression instead of calling lux.properties["{C458F8A7-4AE8-4777-9607-2E9BDD65110A} 62"] Since this returns a generic WinRT object type (equivalent of .NET System.Object), you probably need to use the Maybe something like this? import winsdk.windows.devices.sensors as ds
import winsdk.windows.foundation as wf
als = ds.LightSensor.get_default()
lux = als.get_current_reading()
p_x = lux.properties["{C458F8A7-4AE8-4777-9607-2E9BDD65110A} 62"]
x = wf.IPropertyValue._from(p_x).get_single()
print(x) Also see pywinrt/pywinrt#8. |
Beta Was this translation helpful? Give feedback.
-
it works , thanks David |
Beta Was this translation helpful? Give feedback.
Python tip: you can use Python subscript expression instead of calling
lookup
on a IMapView:Since this returns a generic WinRT object type (equivalent of .NET System.Object), you probably need to use the
IPropertyValue
APIs to get the value. See https://github.com/pywinrt/pywinrt/blob/main/test/test_property_value.py for extensive examples.Maybe something like this?