模拟鼠标滚动

import win32api
from win32con import MOUSEEVENTF_WHEEL
 
 
win32api.mouse_event(MOUSEEVENTF_WHEEL, 0, 0, x)
# x为滚动单位,正数表示向上滚动,负数表示向下滚动

滚动一屏

from win32api import GetSystemMetrics
 
 
 
# width = GetSystemMetrics(0)
height = GetSystemMetrics(1)
win32api.mouse_event(MOUSEEVENTF_WHEEL, 0, 0, -height)
posted @ 2024-06-03 15:24  中华强  阅读(40)  评论(0)    收藏  举报