Skip to content

Instantly share code, notes, and snippets.

@SKaplanOfficial
Created June 22, 2022 06:33
Show Gist options
  • Save SKaplanOfficial/3b6225d6e15b2f2ca1296758c636a570 to your computer and use it in GitHub Desktop.
Save SKaplanOfficial/3b6225d6e15b2f2ca1296758c636a570 to your computer and use it in GitHub Desktop.
Setting the bounds of a Finder window with PyXA
import PyXA
app = PyXA.application("Finder")
window = app.windows()[0]
lock = False
old_w = 0
old_h = 0
while True:
if window.position.y < 50 and lock is False:
# Increase height of window when user drags it to the top
(old_w, old_h) = window.bounds.size
(x, y) = window.position
window.set_property("bounds", ((x, y), (old_w, 2000)))
lock = True
if lock is True and window.position.y > 55:
# Return to original size if user moves window down
(x, y) = window.position
window.set_property("bounds", ((x, y), (old_w, old_h)))
lock = False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment