中文 | English
API: UIA Slider
The Slider control is used to adjust a numeric value, such as volume, brightness, or contrast.
Finding a Slider
Note: Sliders usually have descriptive names.
from wingman import uia
# 查找名为"音量"的滑块
slider = uia.find_by_name("音量")
if slider:
print("找到滑块")2
3
4
5
6
Getting the current value
Not implemented (planned): The
get_info()return keys have no numeric field (novalue), andget_value()returns the element text (implemented asgetText), not the slider value. Reading the slider's current value is currently unavailable.
from wingman import uia
slider = uia.find_by_name("音量")
if slider:
# get_info 无数值字段,这里只读取通用信息
info = slider["get_info"]()
print(f"名称: {info.get('name', '')}")2
3
4
5
6
7
Setting the slider value
Not implemented (planned):
set_value(number)cannot set the slider value —set_valueis implemented as setting the element text (setText), and calling it on a Slider does not move the slider or change its value. Adjusting the value must wait for the Range/Value pattern interfaces; as a transitional workaround,input.scroll()or drag simulation can be used.
from wingman import input
# 过渡方案:鼠标移到滑块上后用滚轮微调(方向取决于应用)
input.move(400, 300)
input.scroll(400, 300, -1)2
3
4
5
Getting the slider range
Not implemented (planned): The
get_info()return keys have nominimum/maximumfields. Reading the slider range is currently unavailable.
Available Interfaces
| Python function | Lua function | Description |
|---|---|---|
find_by_name(name) | find_by_name(name) | Find by name |
| Python method | Lua method | Description |
|---|---|---|
get_info() | :get_info() | Get general information about the slider |
Not implemented (planned): Reading the slider value/range (
get_valuenumeric semantics,minimum/maximumfields) and setting it (set_valuenumeric semantics) are both not implemented —get_value/set_valueactually read/set the element text and only work for text-type controls.