Skip to main content

Window manager and monitor for Windows

Project description

Windows Window Manager

A Python library for managing Windows windows using win32gui and ctypes. This project provides a robust interface for identifying, controlling, and monitoring windows on Windows systems.

Features

  • Window Identification: Get detailed information about all open windows (Handle, Title, Class Name, PID, Process Name).
  • Window Search: Find windows by title or class name with exact or partial matching.
  • Window Control:
    • Minimize, Maximize, Restore
    • Close
    • Move and Resize
    • Set to Foreground
  • Real-time Monitoring: Monitor window creation, destruction, and state changes.
  • Robust Error Handling: Handles permissions and invalid handles gracefully.

Installation

This project uses uv for dependency management.

  1. Clone the repository.
  2. Install dependencies:
    uv sync
    

Usage

Basic Example

from window_manager import WindowManager

manager = WindowManager()

# List all visible windows
windows = manager.get_all_windows(visible_only=True)
for window in windows:
    print(window)

# Find a window
notepad = manager.find_windows(title="Notepad")[0]

# Minimize
manager.minimize_window(notepad.handle)

# Restore
manager.restore_window(notepad.handle)

Monitoring Example

import time
from window_manager import WindowMonitor

def callback(event, hwnd, title):
    print(f"Event: {event}, Window: {title}")

monitor = WindowMonitor(callback=callback)
monitor.start()

try:
    while True:
        time.sleep(1)
except KeyboardInterrupt:
    monitor.stop()

Running Tests

uv run pytest tests

Documentation

See docs/API.md for detailed API documentation.

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

python_win_windows_manager-0.1.0.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

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

python_win_windows_manager-0.1.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file python_win_windows_manager-0.1.0.tar.gz.

File metadata

  • Download URL: python_win_windows_manager-0.1.0.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for python_win_windows_manager-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c7e22e5a7d8858d7a7de9528d48bd33b7156de0ad8ac3d148779e34b9491a0a2
MD5 329a529cb9ff69148e0dd99957a565f1
BLAKE2b-256 b62b892817e7a04f43b424be62780a14657d8a02bc8b6bd790e73310c07b4ee3

See more details on using hashes here.

File details

Details for the file python_win_windows_manager-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: python_win_windows_manager-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for python_win_windows_manager-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 49d4da7f4729e0905506448c59fe521fb5716141bb9922145c4b59c2c8730177
MD5 52c28adf5cb3abb6c228cfe7f68d2278
BLAKE2b-256 2d974ce1ce877ddae4999e982c2f24f1ed5b326fdfd29d7f29c2425ff0798086

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