turn monitor off and on

Leotis buchanan LeotisBuchanan at exterbox.com
Fri May 20 06:37:31 EDT 2011


@Astan

If you really want to turn your monitor on and off, you should probably try
pyserial are pyparrallel(http://pyserial.sourceforge.net/pyparallel.html),
along with a solid state relay. That worked for me on linux not sure about
windowXP,but it should work.

On Sat, May 14, 2011 at 1:08 AM, Astan Chee <astan.chee at gmail.com> wrote:

> Hi,
> I'm trying to turn off my monitor, pause and then turn it on again.
> I'm doing this in python 2.6 and windows xp. Here is my script so far
> (that doesn't work):
>
> import time
> import win32gui
> import win32con
> import win32api
>
> def turnOffMonitor():
>  SC_MONITORPOWER = 0xF170
>  win32gui.SendMessage(win32con.HWND_BROADCAST,
> win32con.WM_SYSCOMMAND, SC_MONITORPOWER, 2)
>
> def turnOnMonitor():
>  SC_MONITORPOWER = 0xF170
>  win32gui.SendMessage(win32con.HWND_BROADCAST,
> win32con.WM_SYSCOMMAND, SC_MONITORPOWER, -1)
>
> if __name__ == "__main__":
>  turnOffMonitor()
>  time.sleep(5)
>  turnOnMonitor()
>
> For some reason, the script doesn't turn the monitor back on. What am
> I doing wrong here or are there any other alternative?
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Regards
Leotis Buchanan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110520/1781d4e9/attachment.html>


More information about the Python-list mailing list