python安卓模拟器图像识别_屏幕截图 从安卓模拟器中识别出屏幕文字

A raster-operation code. These codes define how the color data for the source rectangle is to be combined with the color data for the destination rectangle to achieve the final color.import timeimport...
摘要由CSDN通过智能技术生成

A raster-operation code. These codes define how the color data for the source rectangle is to be combined with the color data for the destination rectangle to achieve the final color.

import time

import win32gui, win32ui, win32con, win32api

# 将app窗口置为当前窗口

time.sleep(3)

l = [(262, 95), (250, 507)]

for i in l:

x, y = i

win32api.SetCursorPos([x, y])

win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y)

time.sleep(0.05)

win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y)

time.sleep(0.05)

win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y)

time.sleep(0.05)

win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y)

img_fn = 'my.screenshot.png'

hwnd = 0 # 窗口的编号,0号表示当前活跃窗口

# 根据窗口句柄获取窗口的设备上下文DC(Divice Context)

hwndDC = win32gui.GetWindowDC(hwnd)

# 根据窗口的DC获取mfcDC

mfcDC = win32ui.CreateDCFromHandle(hwndDC)

# mfcDC创建可兼容的DC

saveDC = mfcDC.CreateCompatibleDC()

# 创建bigmap准备保存图片

saveBitMap = win32ui.CreateBitmap()

# 获取监控器信息

MoniterDev = win32api.EnumDisplayMonitors(None, None)

w = MoniterDev[0][2][2]</

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值