auto window task
Project description
Installation
General
pip install aclib.autowin
Work with dm
pip install aclib.autowin[dm]
Work with cv
pip install aclib.autowin[cv]
Add Windows.Graphics.Capture support for cv
pip install zbl
Full installation
pip install aclib.autowin[full]
Usage
# base typing
from aclib.autowin import _Pos, _Size, _Area, _Areas
# base api
from aclib.autowin import BaseWindow, screen, Window
# create win32 application
from aclib.autowin.appwindow import AppWindow
# css typing
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from aclib.autowin.appwindow._typing import _AppCSS
# use opencv
from aclib.autowin.cvwindow import CvWindow # [cv] requires
# use dm plugin
from aclib.autowin.dmwindow import DmWindow # [dm] requires
Examples
from aclib.autowin.cvwindow import CvWindow
# Get window
win = CvWindow.findwindow('游戏窗口标题')
if not win:
raise Exception('not found window')
# Enable Windows.Graphics.Capture(WGC).
# If the target window doesn't support GDI capture, use WGC.
# Run "pip install zbl" with a 64-bit python first.
win.cv_start_wgc()
# Release WGC
win.cv_stop_wgc()
# Show capture to test if cvwindow works or not
cap = win.cvcapture()
cap.show(usebrowser=True)
# Find color
area = (0, 0, 1920, 1080)
target = win.cvfindcolor('ffffff|000000--222222|888888-101010', area)
targets = win.cvfindcolors('ffffff|000000--222222|888888-101010', area)
print(target)
# Set dotsetlib
dlib = CvWindow.DotsetLib.fromfile(r"点阵库路径")
win.cvset(dlib=dlib)
# Find dotset
area = (0, 0, 1920, 1080)
target = win.cvfinddotset('点阵名称', area)
targets = win.cvfinddotsets('点阵名称', area)
print(target)
# Set fontlib
flib = CvWindow.FontLib.fromfile(r"字库路径")
win.cvset(flib=flib)
# Find text
area = (0, 0, 1920, 1080)
target = win.cvfindtext('文本', area)
targets = win.cvfindtexts('文本', area)
line_targets = win.cvocr(area)
print(target)
# use target
print(target.name)
print(target.start)
print(target.center)
print(target.end)
print(target.similarity)
target.click_if_exists()
if not target:
print('not found target')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aclib_autowin-1.5.5.tar.gz
(18.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aclib_autowin-1.5.5.tar.gz.
File metadata
- Download URL: aclib_autowin-1.5.5.tar.gz
- Upload date:
- Size: 18.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f290e96768c18ef14c6357f88a2305d046b136507d9cd7c931e57fc7fbef6f3
|
|
| MD5 |
77aab6319238194edbffcf7262b458f4
|
|
| BLAKE2b-256 |
0426f826a3dce8df965716a8a8a3d6c58c902650224e781b8d65398368a48fa0
|
File details
Details for the file aclib_autowin-1.5.5-py3-none-any.whl.
File metadata
- Download URL: aclib_autowin-1.5.5-py3-none-any.whl
- Upload date:
- Size: 20.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7ddf226cf1b10130986dea0791ccbf92c431f6a720f48a875ef4c3f3a861c29
|
|
| MD5 |
d8d22ec347d9f00816cf12d052e74be0
|
|
| BLAKE2b-256 |
941af881780e4704b4f7d2a13bda5467c9e0fe5ca0e6f75e4a46f442b5e9896f
|