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)
Release files for win-pos 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| win-pos-0.0.2.tar.gz | 2.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| win_pos-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.7 kB
Release files / win-pos-0.0.2.tar.gz
| Download URL | win-pos-0.0.2.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5bbac883150f66941ae9a298d38e25e13eb18fc2a025de79c74c02591d72ff5e
|
|
BLAKE2b-256 checksum How to use checksums |
f1e8491349c084db852c861878c7c284bf33d5e080784e2bfe872158a66afbba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|
Release files / win_pos-0.0.2-py3-none-any.whl
| Download URL | win_pos-0.0.2-py3-none-any.whl |
|---|---|
| Size | 2.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9f0199966ce4fd364e95727375348de3e766b090b71d515fd09e23072bb69c61
|
|
BLAKE2b-256 checksum How to use checksums |
725db180ed8256ec7d216c322c5479c06c1939e9c6bd117aa7f10a64983b9be4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|