diff --git a/dist/PyWinBox-0.0.8-py3-none-any.whl b/dist/PyWinBox-0.0.9-py3-none-any.whl similarity index 92% rename from dist/PyWinBox-0.0.8-py3-none-any.whl rename to dist/PyWinBox-0.0.9-py3-none-any.whl index a1ea76e..a28f94b 100644 Binary files a/dist/PyWinBox-0.0.8-py3-none-any.whl and b/dist/PyWinBox-0.0.9-py3-none-any.whl differ diff --git a/src/pywinbox/__init__.py b/src/pywinbox/__init__.py index 8cf2589..8d85647 100644 --- a/src/pywinbox/__init__.py +++ b/src/pywinbox/__init__.py @@ -4,13 +4,13 @@ import sys from collections.abc import Callable -from typing import Union, Tuple, overload, Optional, NamedTuple +from typing import Union, Tuple, NamedTuple __all__ = [ "version", "PyWinBox", "defaultOnQuery", "defaultOnSet", "Box", "Rect", "Point", "Size", "pointInBox" ] -__version__ = "0.0.8" +__version__ = "0.0.9" def version(numberOnly: bool = True): diff --git a/src/pywinbox/_pywinbox_win.py b/src/pywinbox/_pywinbox_win.py index 6611b80..e494bf5 100644 --- a/src/pywinbox/_pywinbox_win.py +++ b/src/pywinbox/_pywinbox_win.py @@ -33,7 +33,7 @@ def _getHandle(handle: Union[int, str]) -> Optional[int]: def _getWindowBox(handle: int) -> Box: x, y, r, b = win32gui.GetWindowRect(handle) - return Box(x, y, abs(r - abs(x)), abs(b - abs(y))) + return Box(x, y, abs(r - x), abs(b - y)) def _moveResizeWindow(handle: int, newBox: Box): diff --git a/tests/test_pywinbox.py b/tests/test_pywinbox.py index 0078d94..2bed6ed 100644 --- a/tests/test_pywinbox.py +++ b/tests/test_pywinbox.py @@ -55,77 +55,96 @@ def test_basic(): else: myPyBox = pywinbox.PyWinBox(onQuery=pywinbox.defaultOnQuery, onSet=pywinbox.defaultOnSet, handle=npw.getHandle()) + print("INIT", npw.box, npw.rect) myPyBox.left = 250 time.sleep(timelap) + print("LEFT", npw.box, npw.rect) assert npw.left == 250 myPyBox.right = 950 time.sleep(timelap) + print("RIGHT", npw.box, npw.rect) assert npw.right == 950 myPyBox.top = 150 time.sleep(timelap) + print("TOP", npw.box, npw.rect) assert npw.top == 150 myPyBox.bottom = 775 time.sleep(timelap) + print("BOTTOM", npw.box, npw.rect) assert npw.bottom == 775 myPyBox.topleft = (155, 350) time.sleep(timelap) + print(npw.box, npw.rect) assert npw.topleft == (155, 350) myPyBox.topright = (1000, 300) time.sleep(timelap) + print(npw.box, npw.rect) assert npw.topright == (1000, 300) myPyBox.bottomleft = (300, 975) time.sleep(timelap) + print(npw.box, npw.rect) assert npw.bottomleft == (300, 975) myPyBox.bottomright = (1000, 900) time.sleep(timelap) + print(npw.box, npw.rect) assert npw.bottomright == (1000, 900) myPyBox.midleft = (300, 400) time.sleep(timelap) + print(npw.box, npw.rect) assert npw.midleft == (300, 400) myPyBox.midright = (1050, 600) time.sleep(timelap) + print(npw.box, npw.rect) assert npw.midright == (1050, 600) myPyBox.midtop = (500, 350) time.sleep(timelap) + print(npw.box, npw.rect) assert npw.midtop == (500, 350) myPyBox.midbottom = (500, 800) time.sleep(timelap) + print(npw.box, npw.rect) assert npw.midbottom == (500, 800) myPyBox.center = (500, 350) time.sleep(timelap) + print(npw.box, npw.rect) assert npw.center == (500, 350) myPyBox.centerx = 1000 time.sleep(timelap) + print(npw.box, npw.rect) assert npw.centerx == 1000 myPyBox.centery = 600 time.sleep(timelap) + print(npw.box, npw.rect) assert npw.centery == 600 myPyBox.width = 700 time.sleep(timelap) + print(npw.box, npw.rect) assert npw.width == 700 myPyBox.height = 500 time.sleep(timelap) + print(npw.box, npw.rect) assert npw.height == 500 myPyBox.size = (801, 601) time.sleep(timelap) + print(npw.box, npw.rect) assert npw.size == (801, 601) # Test closing