python3+uiautomator2实现在画图板画个圆

import sys
sys.path.append(r'C:\Users\Miiow\source\repos\PythonTest\PythonTest')
import connect
import math

d = connect.d() 
#import uiautomator2 as u2
#import time

#d = u2.connect('192.168.8.99:5555')
size = d.window_size()
x1 = int(size[0] * 0.5)
y1 = int(size[1] * 0.5)
x0=x1
y0=y1
r=400

def mathtest():
    print(math.pi) #打印pi的值
    print(math.radians(180))  #把度数转化为弧度,即180=pi

    sin90 = math.sin(math.pi/2)  #计算sin(pi/2)
    sin180 = math.sin(math.pi)  #计算sin(pi)
    cos90 = math.cos(math.pi/2) #计算cos(pi/2)
    cos180 = math.cos(math.pi)  #计算cos(pi)
    print('sin90 is {}  ,sin180 is {}  ;cos90 is {}  ,cos180 is {}  .'.format(sin90,sin180,cos90,cos180))

d(resourceId="com.color365.drawboard:id/tool_add").click()
#圆点坐标:(x0,y0) 半径:r 角度:a0
#则圆上任一点为:(x1,y1)
#x1 = x0 + r * cos(ao)
#y1 = y0 + r * sin(ao )
d.click(x0,y0)

for r in range(50,400,50):
    for a0 in range(0,360,5):
        x=x0+r*math.cos(a0*math.pi/180)
        y=y0+r*math.sin(a0*math.pi/180)
        print('角度:{},X:{},Y:{}'.format(a0,x,y))
        d.click(x,y)

d(resourceId="com.color365.drawboard:id/tool_add").click()
for x in range(x1-300,x1+300,30):
    for y in range(y1-500,y1+400,30):
        d.click(x,y)

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

功克

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值