Setting an app window to a specific size in Windows ๐ŸชŸ

I’m about to record some demo videos and needed to set the resolution of the apps I will be recording to 1920 x 1080, there isn’t a straightforward way to do this out of the box with Windows (that I know of ๐Ÿค”). After much research I found the Python module PyGetWindow which can do this.

After installing the module using pip install PyGetWindow, I put together the following script which lists all of the current open apps and then sets the resolution of Notepad to 1920 x 1080 (using the name of the window, taken from the listing of open apps).

import pygetwindow

# Get all of the currently opened windows
windows = pygetwindow.getAllTitles()

# Print a list of the currently opened windows
for window in windows:
    print(window)

# Specify the name of the window to resize
notepad = pygetwindow.getWindowsWithTitle("Untitled - Notepad")[0]

#resize the window
notepad.resizeTo(1920, 1080)

Comments

Leave a comment