More actions
Created page with "<syntaxhighlight lang="python"> #!/usr/bin/python3 import win32api, win32con, argparse screenid = 1 a = argparse.ArgumentParser() a.add_argument('on', nargs="?", default=False, type=lambda x: x.lower() not in ("false", "0", "off")) b = a.parse_args() screenstring = f"\\\\.\\DISPLAY{screenid:d}" if b.on: win32api.ChangeDisplaySettingsEx(screenstring, None) else: s = win32api.EnumDisplaySettings(screenstring, win32con.ENUM_CURRENT_SETTINGS) s.PelsWidth = 0..." |
m Derg moved page Displaytoggle.py to displaytoggle.py without leaving a redirect |
(No difference)
|
Latest revision as of 13:50, 12 September 2024
#!/usr/bin/python3
import win32api, win32con, argparse
screenid = 1
a = argparse.ArgumentParser()
a.add_argument('on', nargs="?", default=False, type=lambda x: x.lower() not in ("false", "0", "off"))
b = a.parse_args()
screenstring = f"\\\\.\\DISPLAY{screenid:d}"
if b.on:
win32api.ChangeDisplaySettingsEx(screenstring, None)
else:
s = win32api.EnumDisplaySettings(screenstring, win32con.ENUM_CURRENT_SETTINGS)
s.PelsWidth = 0
s.PelsHeight = 0
win32api.ChangeDisplaySettingsEx(screenstring, s)