Skip to main content

A tiny Python utility library used to get the bounds of an application window.

The get_window_pos function takes either a string, or a callable where the first argument is a string and that returns a boolean.

As an example, we'll get the position of Discord. As Discord's window title can vary depending on what server and channel you're in, we'll take advantage of the expected callable and pass a lambda to see if the window ends with 'Discord'.

from WinPos import get_window_pos

get_window_pos(lambda title: title.endswith('Discord'))
# (619, 473, 1624, 716)

Not all windows are as complicated as Discord, fortunately. If the window you're trying to get the position of is static and never changes, you can simply pass a string through and get your value.

from WinPos import get_window_pos

get_window_pos('Task Manager')
# (125, 117, 895, 726)

If for whatever reason you need to repeatedly get the position of the same window, you can import get_window_hwnd and get_window_pos_from_hwnd functions. This will save some time from not having to iterate over every application to check the title.

from WinPos import get_window_hwnd, get_window_pos_from_hwnd

hwnd = get_window_hwnd('Task Manager')
get_window_pos_from_hwnd(hwnd)
# (125, 117, 895, 726)

Download files

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

Source Distribution

win-pos-0.0.2.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

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

win_pos-0.0.2-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file win-pos-0.0.2.tar.gz.

File metadata

  • Download URL: win-pos-0.0.2.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for win-pos-0.0.2.tar.gz
Algorithm Hash digest
SHA256 5bbac883150f66941ae9a298d38e25e13eb18fc2a025de79c74c02591d72ff5e
MD5 5785646a23e95f23653fd7e0d66bbbe6
BLAKE2b-256 f1e8491349c084db852c861878c7c284bf33d5e080784e2bfe872158a66afbba

See more details on using hashes here.

File details

Details for the file win_pos-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: win_pos-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for win_pos-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9f0199966ce4fd364e95727375348de3e766b090b71d515fd09e23072bb69c61
MD5 63b1e9fc8ac34f031fff51b3d62fa83b
BLAKE2b-256 725db180ed8256ec7d216c322c5479c06c1939e9c6bd117aa7f10a64983b9be4

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.0

2 files

This release

0.0.2 This release

2 files

Supported by

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