0% found this document useful (0 votes)
2 views1 page

Python Script to Control Screen Power

Uploaded by

nn1521513
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Python Script to Control Screen Power

Uploaded by

nn1521513
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

import time

import ctypes
import win32api, win32con
def screen_off():
[Link](65535, 274, 61808, 2)
def screen_on():
[Link](65535, 274, 61808, -1)
move_cursor()
def move_cursor():
x, y = (0,0)
win32api.mouse_event(win32con.MOUSEEVENTF_MOVE, x, y)

screen_off()
[Link](3)
screen_on()

import time
import win32api
import win32con

def ScreenOFF():
"""
Function to turn off the screen.
"""
return [Link](win32con.HWND_BROADCAST,
win32con.WM_SYSCOMMAND, win32con.SC_MONITORPOWER, 2)

def ScreenON():
"""
Function to turn on the screen.
"""
return [Link](win32con.HWND_BROADCAST,
win32con.WM_SYSCOMMAND, win32con.SC_MONITORPOWER, -1)

ScreenOFF()
[Link](5)
ScreenON()
[Link](5)

You might also like