当前位置:网站首页>[pyautogui learning] screen coordinates and mouse scrolling
[pyautogui learning] screen coordinates and mouse scrolling
2022-07-23 11:33:00 【Cheryl_ Xu】
List of articles
Pyautogui Study – Screen coordinates 、 Mouse scrolling
Recent research WindowsGUI automated testing , So we will study the commonly used libraries 、 I learned a little .
size()-position()-onScreen()
# ${date}
# author:Cheryl Xu
# Named tuple function
from collections import namedtuple
from pyautogui import size, position, onScreen
# Content of a : Understand the named tuples used in the Library namedtuple
# Size = namedtuple("Size", "width height") # Initialize the definition tuple , The name of the incoming tuple 、 The name of the element in the tuple
# screen_size = Size(1920, 1080)
# print(screen_size)
# print(screen_size.width, screen_size.height)
# print(screen_size[0], screen_size[1])
def test_size():
"""size() - Get screen resolution size """
screen_size = size()
print(screen_size.width, screen_size.height)
def test_position():
"""position() - Get the current mouse coordinates """
point = position()
print(point.x, point.y)
def test_onScreen():
"""onScreen() - Determine whether a coordinate is in the screen """
print(onScreen(-1,0))
print(onScreen(0,0))
print(onScreen((1919,1079)))
print(onScreen([1919,1080]))
if __name__ == '__main__':
test_size()
test_position()
move()-moveTo()
# ${date}
# author:Cheryl Xu
from pyautogui import moveTo, move
def test_moveTo():
"""moveTo() - Move the mouse cursor to the specified position """
# moveTo(0,0)
# moveTo([500,500])
# moveTo((200,200))
moveTo(100, 100, duration=2.5)
def test_move():
"""move() - Relative to the current mouse cursor position , Move the specified pixel """
move(200, 200, duration=2.5)
# test_moveTo()
test_move()
边栏推荐
- 解决手动查询Oracle数据库时间格式不正确的问题(DATE类型)
- MySQL增删改查&&高级查询语句
- Web Component-自定義元素的生命周期
- The problem that GBK codec cannot decode may be caused by the file name
- window下vmware使用无线网卡nat的方式上网
- The attribution of branch and loop statements in C language
- TypeScript 常用类型
- Application of higher-order functions: handwritten promise source code (4)
- Handwritten promise.resolve, promise reject, Promise.all
- Points for attention when using El table to lazy load tree tables
猜你喜欢

flex+js实现内部盒子高度跟随其中最大的高度

数字藏品系统开发:百度AI致敬中国航空

Basis of penetration test

文件上传漏洞原理

Laravel API interface + token authentication login

kubesphere haproxy+keepalived (一)

Clear the buffer with getchar (strongly recommended, C language is error prone, typical)

my_strcpy的实现(经典,简单,实用,收藏)

User defined MVC usage & addition, deletion, modification and query

The problem that GBK codec cannot decode may be caused by the file name
随机推荐
命令执行漏洞及防御
Niuke question brushing record -- MySQL
D2dengine edible tutorial (1) -- the simplest program
高阶函数的应用:手写Promise源码(三)
【C语言】什么是函数?函数的分类和侧重(帮你快速分类和记忆函数)
JS higher order function
DVWA学习笔记
Application of higher-order functions: handwritten promise source code (4)
NFT数字藏品开发/DAPP开发
NFT数字藏品开发:数字藏品在未来究竟有哪些可能的应用场景?
The tree form based on El table and JS xlsx realize the function of downloading excel (II)
Application of higher-order functions: handwritten promise source code (III)
kubesphere HA install (二)
Genesis曾向三箭资本提供23.6亿美元的贷款
数字藏品开发/数字藏品系统开发解决方案
last-child不生效问题
自定义forEach标签&&select标签实现回显数据
如何自定义Jsp标签
第六届“蓝帽杯”全国大学生网络安全技能大赛-初赛Writeup
Web Component-自定義元素的生命周期