How can I set value on slider

573 Views Asked by At

I tried set value on slider. I can connect to it. But then I try set value catch _ctypes.COMError: (-2146233079, None, (None, None, None, 0, None)) I tried this, but it not helps.

1

There are 1 best solutions below

1
On BEST ANSWER

Hmm... This is interesting. We have working unit tests for standard WPF slider. See test_uiawrapper.py, line 780 for reference.

Everything looks the same in Inspect.exe also. But for WpfApplication1.exe it works.

[EDIT] Wait! You pass int number to set_value(...), how about float or str?

P.S. I can suggest a workaround since you should have "thumb" control as a child of the slider: slider.children(control_type="Thumb")[0]. You can play with rectangles of the slider and the thumb (.rectangle().mid_point()), then use click_input(coords=(x, y), absolute=False) with relative coordinates calculated for specified value. Or even .drag_mouse_input(...) is better, because one click should call just a small move in the direction of click.