Every time I turn my monitor I have to go in the settings, any way to automate the changing of the screen orientation in Python? I'm on Windows 10.
I have tried using the shortcut (ctrl alt right) but that doesn't work.
This is something ChatGPT came up with:
from screeninfo import get_monitors
import subprocess
def rotate_screen():
# Get information about all monitors
monitors = list(get_monitors())
# Assuming the second monitor is the one you want to rotate
if len(monitors) > 1:
subprocess.run(["DisplaySwitch.exe", "/rotate:90"])
if __name__ == "__main__":
rotate_screen()
displayswitch is for selecting how to mirror your screen to a second screen
you can use Display64.exe then the following code can be used.
more info can be found here and here