Skip to main content

SimpleWin32 简单使用pywin32框架

安装

pip install simplewin32

引用

from SimpleWin32.simplewin32 import *

可使用对象

KeyCode

快捷使用键盘字符码

MouseEvent

鼠标的左右中键的点击事件定义

Mouse

进行鼠标操作的类,可以使用方法链的形式进行调用

  • move: 鼠标移动
  • roll: 鼠标滚动
  • mouse_position: 获取当前鼠标位置
  • click: 前台鼠标点击
  • bg_Click: 后台点击

Keyboard

键盘事件的操作类

  • click: 点击
  • press: 按下
  • release: 松开
  • bg_Click: 后台点击

Message

进行输入、弹窗等文字类的操作,包含弹窗的基本类型

  • InputMessage: 输入文字
  • AlertMessage: 弹出信息框
  • SetText: 窗口设置文字

ClipBoard

粘贴板设置和获取值操作类

  • SetClipboard: 设置粘贴板文字
  • GetClipboard: 获取粘贴板文字

Window

集合以及二次封装了窗口方法,便捷获取窗口信息、枚举窗口句柄等操作

  • GetSystemMetrics: 获取屏幕尺寸
  • GetDeviceCaps: 获取屏幕分辨率
  • ComputerDeviceScale: 计算设备缩放比
  • GetAllWindows: 获取所有的窗口或一级子窗口
  • FindWindow: 搜索窗口
  • GetWindowInfo: 获取窗口class、title
  • MoveOrResizeWindow: 设置窗口大小和位置
  • ShowWindow: 显示窗口
  • GetCurrentWindow: 获取当前窗口句柄值以及title和class
  • GetWindowRect: 获取窗口坐标位置
  • MarkChildWindow: 标记窗口句柄位置(需要numpy、opencv和pillow库支持)
  • FuzzySearchWindow: 通过class和窗口title模糊搜索窗口句柄

Voice

声音模块

  • Speak: 将文字转换为电脑语音朗读,调用本地电脑api

Custom

封装了一些常用的窗口操作方法:

  • UploadFile: 文件上传操作

Release files for SimpleWin32 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for SimpleWin32 0.1.5
File Size Uploaded
SimpleWin32-0.1.5.tar.gz 10.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for SimpleWin32 0.1.5
File Interpreter ABI Platform
SimpleWin32-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 20.4 kB

Release files / SimpleWin32-0.1.5.tar.gz

Download URL SimpleWin32-0.1.5.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e70ce80d8b0796b704b32910713505019b85e057972628c0194991f77acdf0e7
BLAKE2b-256 checksum
How to use checksums
a6eb84fcdbb9b057e257900c6f17b766a307c82c0141aceae9a0ac43070e520f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10

Release files / SimpleWin32-0.1.5-py3-none-any.whl

Download URL SimpleWin32-0.1.5-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dde2b84baf0bec3aacdd4854cb134fa1e4226a765fca96355376188272d8a3f5
BLAKE2b-256 checksum
How to use checksums
17e9a47bcf93594bdad497eeeae048272a2c0901b1c7dc9e30f995b9b6166822
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page