Skip to main content

模拟键盘,鼠标事件的Python包。A Python package simulating keyboard and mouse events Author: 七分诚意

Project description

模拟键盘,鼠标事件的Python包。 A Python package simulating keyboard and mouse events模块名称: event - 切勿使用import userevent !

Build passing 100% test coverage

简介

event-simulate是一个模拟键盘,鼠标事件的Python包, 可以模拟鼠标单击、双击, 键盘按下等各种操作,

可用于编写自动化程序 (如游戏外挂)。

所包含模块 Included modules:

event.key - 模拟键盘事件

包含的函数 Functions:

keydown(keycode_or_keyname):

模拟键按下。
keycode_or_keyname:按键名称或该按键的键码值

keypress(keycode_or_keyname, delay=0.05):

模拟按键。
keycode_or_keyname:按键名称或该按键的键码值
delay:键按下与释放之间的的间隔时间,间隔时间越小,按键速度越快。

keyup(keycode_or_keyname):

模拟键释放。
keycode_or_keyname:按键名称或该按键的键码值

event.mouse - 模拟鼠标事件

包含的函数 Functions:

click():

模拟鼠标左键单击

dblclick(delay=0.25):

模拟鼠标左键双击

get_screensize():

获取当前屏幕分辨率。

getpos():

获取当前鼠标位置。
返回值为一个元组,以(x,y)形式表示。

move(x, y):

模拟移动鼠标。
与goto不同,move()*产生*一个鼠标事件。

right_click():

模拟鼠标右键单击。

示例代码1: .. code-block:: python

#模拟按键Alt+F4关闭当前窗口 from event.key import * keydown(“Alt”) keydown(“f4”) keyup(“f4”) keyup(“alt”)

示例代码2: .. code-block:: python

#使用Aero Peek预览桌面。(Win7及以上系统) from event import mouse x,y=mouse.get_screensize() mouse.move(x,y) #将鼠标移至屏幕右下角 mouse.click() #模拟鼠标点击

新增功能:

增加了示例:鼠标控制器(包目录examplesmouseController.py)

修复了调用API函数时出现``ValueError``的bug。

作者 Author:

七分诚意 qq:3076711200 百度账号:徐丹34

邮箱:3416445406@qq.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

event-simulate-1.0.3.tar.gz (5.6 kB view details)

Uploaded Source

File details

Details for the file event-simulate-1.0.3.tar.gz.

File metadata

  • Download URL: event-simulate-1.0.3.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.2rc1

File hashes

Hashes for event-simulate-1.0.3.tar.gz
Algorithm Hash digest
SHA256 28d2c3cdfda12a8dca29fb82138874b0f2c37b00193231494bd7e5efa14b1250
MD5 fd5f70235b4e8e599c89c995822557b5
BLAKE2b-256 1a34ad1a0bbca81242738234e63c706c221afc98bf8a4b0aab9b593be9f7f3b2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page