11

I want to write a program, preferably in Python, that will change the window size of any particular application I have open. E.g. say I have Notepad open and wish to make it 640x400 - my script would recognise the window and change its dimensions automatically.

Is there an available framework in Python for this or do I need to use another language?

user1675111
  • 8,695
  • 4
  • 18
  • 14
  • 4
    Check out this question: http://stackoverflow.com/questions/151846/get-other-running-processes-window-sizes-in-python And this one: http://stackoverflow.com/questions/2335721/how-can-i-get-the-window-focused-on-windows-and-re-size-it – Dmitry VS Sep 05 '15 at 06:08
  • Does this answer your question? [How can I get the window focused on Windows and re-size it?](https://stackoverflow.com/questions/2335721/how-can-i-get-the-window-focused-on-windows-and-re-size-it) – Gino Mempin Nov 03 '20 at 03:18

1 Answers1

11
import pygetwindow
win = pygetwindow.getWindowsWithTitle('Notepad')[0]
win.size = (640, 400)
Mohsen Haddadi
  • 1,296
  • 2
  • 16
  • 20
  • The questing does not meet guidelines for the type questions SO is designed to answer. As such, it behooves you to answer such questions. Instead you should flag for closure, leave a comment guiding the OP to appropriate guidelines or how to bring the Q to standards, ie simply ignore it, and find another Q to answer. If the Q is a duplicate, then flag as a Duplicate or suggest the already answered Q in the Comments. – SherylHohman Nov 02 '20 at 22:32