Skip to main content

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


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.4.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aclib_autowin-1.5.4-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

Details for the file aclib_autowin-1.5.4.tar.gz.

File metadata

  • Download URL: aclib_autowin-1.5.4.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

Hashes for aclib_autowin-1.5.4.tar.gz
Algorithm Hash digest
SHA256 75b581d56260607d235a7ec495c71f937d20e718177258a59bee6993d225e79a
MD5 066e15149f4b5cd3aef968c3658872ef
BLAKE2b-256 e7654b9b1603e22a4c320871551bded7f1812af302a665ea53d37c9b93de6a79

See more details on using hashes here.

File details

Details for the file aclib_autowin-1.5.4-py3-none-any.whl.

File metadata

  • Download URL: aclib_autowin-1.5.4-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

Hashes for aclib_autowin-1.5.4-py3-none-any.whl
Algorithm Hash digest
SHA256 bd2b1cfa3f9120bbd681433634fc11cd4c8248c108b7e8df7554d1d979914e3f
MD5 893242fb82a91c1ec164c97ab8ad7465
BLAKE2b-256 cde4546fa58727d48bd152551e0f389071ba8648bf347e5f0c113b82c9e20759

See more details on using hashes here.

Supported by

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