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.1.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.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: python_win_windows_manager-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 4f9bfcacde32b18ba2177d241850edf83fb12eaf9d02177da647d7f32c840c82
MD5 459f6151c05257f051a44b474a5767fa
BLAKE2b-256 361ecffa42309af56c17dee18a2c0ef34a3b136ff01d3a5b88954f35815f438f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: python_win_windows_manager-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8e7f3b60c85b9c7140ea30ef33c6d1bb074521dd23dd390ff3a84f301126d653
MD5 e1cc60f9242f9b1e0692f0187cb1e36f
BLAKE2b-256 798a6b4568ebde92ffc77e86799fe4a195ec98af7482ed6725a664fc25e31e5a

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