Skip to main content

No project description provided

Project description

wmutil

Utility functions for getting monitor (display) information on Windows.

import wmutil


# Enumerate all monitors
print('Enumerating monitors:')
for monitor in wmutil.enumerate_monitors():
    # Print monitor attributes
    print(monitor, monitor.name, monitor.size, monitor.position, monitor.refresh_rate_millihertz, monitor.handle, sep='\n\t')


# Get primary monitor
primary_monitor = wmutil.get_primary_monitor()

# Get a monitor based on point coordinates
monitor = wmutil.get_monitor_from_point(0, 0)

# compare monitor objects
if monitor == primary_monitor:
   print('it is the primary monitor')


# Get monitor from an HWND
from ahk import AHK  # pip install ahk[binary]
ahk = AHK()

window = ahk.active_window
hwnd = int(window.id, 0)
monitor_for_active_window = wmutil.get_window_monitor(hwnd)
print(window.title, 'is using monitor', monitor_for_active_window.name)

Example output:

Enumerating monitors:
<wmutil.Monitor object; handle=491197379>
        \\.\DISPLAY1
        (1920, 1080)
        (-3840, -418)
        60000
        491197379
<wmutil.Monitor object; handle=85595795>
        \\.\DISPLAY2
        (3440, 1440)
        (0, 0)
        60000
        85595795
it is the primary monitor

Untitled - Notepad is using monitor \\.\DISPLAY2

Notes:

  • monitor.size may not necessarily reflect the monitor's resolution, but rather is the geometry used for drawing or moving windows

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

wmutil-0.1.0-cp312-none-win_amd64.whl (137.5 kB view details)

Uploaded CPython 3.12 Windows x86-64

wmutil-0.1.0-cp311-none-win_amd64.whl (138.0 kB view details)

Uploaded CPython 3.11 Windows x86-64

wmutil-0.1.0-cp310-none-win_amd64.whl (137.9 kB view details)

Uploaded CPython 3.10 Windows x86-64

wmutil-0.1.0-cp39-none-win_amd64.whl (138.6 kB view details)

Uploaded CPython 3.9 Windows x86-64

wmutil-0.1.0-cp38-none-win_amd64.whl (137.6 kB view details)

Uploaded CPython 3.8 Windows x86-64

File details

Details for the file wmutil-0.1.0-cp312-none-win_amd64.whl.

File metadata

  • Download URL: wmutil-0.1.0-cp312-none-win_amd64.whl
  • Upload date:
  • Size: 137.5 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for wmutil-0.1.0-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 27893b451db67514525186c25a7b708c983fe9e6bb3e35ca022b3fb1cfae6865
MD5 d41e56f58ed249d54e5ecdac0d54fd6e
BLAKE2b-256 022a6168053feee9fa17e0a353f6d4e5e9466a5f7bfb96752df4dc1a6fb8f58e

See more details on using hashes here.

Provenance

File details

Details for the file wmutil-0.1.0-cp311-none-win_amd64.whl.

File metadata

  • Download URL: wmutil-0.1.0-cp311-none-win_amd64.whl
  • Upload date:
  • Size: 138.0 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for wmutil-0.1.0-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 62f6293ec7ca7c440ce17945b2b84de59f820b618b330583dd2bb2d4e2949506
MD5 43c34b6103cbfb0d0b8c00899e7764ed
BLAKE2b-256 9d775e78aae675f12655675fed4409db249f5a66b54d6bca1e9b0e52ad815c52

See more details on using hashes here.

Provenance

File details

Details for the file wmutil-0.1.0-cp310-none-win_amd64.whl.

File metadata

  • Download URL: wmutil-0.1.0-cp310-none-win_amd64.whl
  • Upload date:
  • Size: 137.9 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for wmutil-0.1.0-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 39258e3d0689ec4647250330e1317b1c2e7e88356eda1e61fb24f3b70816af2a
MD5 cd8a4dfda0a1808af3213459694aa3fd
BLAKE2b-256 2c991ba9c3b810d18a578d50743caa3cc2da5c757ad269e186a18d5665d3a4cb

See more details on using hashes here.

Provenance

File details

Details for the file wmutil-0.1.0-cp39-none-win_amd64.whl.

File metadata

  • Download URL: wmutil-0.1.0-cp39-none-win_amd64.whl
  • Upload date:
  • Size: 138.6 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for wmutil-0.1.0-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 fa4cea72ba5ea3d44acf8addfc90cf4984504d480c9a5f8dccd80c58dd1c8a4b
MD5 815c4db1614fdacc9fae615b4277fbeb
BLAKE2b-256 d7cd2b612b3c86b36c5f23ba8cb939fdcab83e92d8c298f2276d227290060d9a

See more details on using hashes here.

Provenance

File details

Details for the file wmutil-0.1.0-cp38-none-win_amd64.whl.

File metadata

  • Download URL: wmutil-0.1.0-cp38-none-win_amd64.whl
  • Upload date:
  • Size: 137.6 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for wmutil-0.1.0-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 ae68ede3111738ba52f90d3783d4e27ccf54ba7b6c00aee8d9403df0297f5a7b
MD5 8533c50c16a6064495804490de5473cb
BLAKE2b-256 dd0ec636ffc6586a93c07d5df1ccb5e3774c71e92c8619d44f70b89573d5e469

See more details on using hashes here.

Provenance

Supported by

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