Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #5337

turn monitor off and on

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <astan.chee@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.020
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; '__name__': 0.07; 'python': 0.07; '"__main__":': 0.09; 'monitor': 0.12; 'def': 0.13; '-1)': 0.16; 'pause': 0.16; 'win32api': 0.16; 'win32con': 0.16; 'win32gui': 0.16; 'trying': 0.23; 'reason,': 0.23; 'script': 0.26; 'windows': 0.26; "i'm": 0.26; 'message-id:@mail.gmail.com': 0.28; "doesn't": 0.28; 'hi,': 0.29; 'import': 0.32; 'to:addr:python- list': 0.32; 'there': 0.35; '2.6': 0.35; 'doing': 0.36; 'some': 0.37; 'received:209.85': 0.37; 'received:google.com': 0.38; 'to:addr:python.org': 0.39; 'received:209': 0.39; 'header:Received:5': 0.40; 'back': 0.61; 'here': 0.65; 'subject:off': 0.73; 'received:209.85.210.174': 0.84; 'received :mail-iy0-f174.google.com': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=kDuFwBcGNssxNHtNhgJX3Z68euwEKI9F7ZDZ6tFS6Yw=; b=jswcIXmEdPd9ms3f4u1rsP+1ZUn6mQe8rRTpc+bCzV3RjI5L5boHCQOAblpVh9cPJS 47TwBbvD9BAqy24WarU8tNwlesq3ewt0cUaNy33PqlFyhxbh7B5duEt+zpy85c4ty2L1 Kt3ivXEWMNhYgZ1LEy7o+EXHqU9byOxNsTJy4=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=M4E/7vfwAeY9AB7deKVXHjNgySl3p6zSi5ruePuHDtzjnSfFnmtzpeMkfA3G9culHc +P1kOp/afT3wOdqTvpwisIfzTmYX13DTAynIP/CIsjiPvNSaWdrcvYLoMaOl8gQtOgA0 KYSHRXCQs48aZkNX6ahX64w64N8Bv7CQyhe78=
MIME-Version 1.0
Date Sat, 14 May 2011 16:08:44 +1000
Subject turn monitor off and on
From Astan Chee <astan.chee@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1537.1305353327.9059.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 82.94.164.166
X-Trace 1305353327 news.xs4all.nl 81484 [::ffff:82.94.164.166]:40547
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:5337

Show key headers only | View raw


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?

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

turn monitor off and on Astan Chee <astan.chee@gmail.com> - 2011-05-14 16:08 +1000
  Re: turn monitor off and on harrismh777 <harrismh777@charter.net> - 2011-05-14 02:13 -0500
    Re: turn monitor off and on harrismh777 <harrismh777@charter.net> - 2011-05-14 02:20 -0500
      Re: turn monitor off and on harrismh777 <harrismh777@charter.net> - 2011-05-14 02:29 -0500
        Re: turn monitor off and on Alexander Kapps <alex.kapps@web.de> - 2011-05-14 09:59 +0200
      Re: turn monitor off and on Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-14 07:43 +0000
        Re: turn monitor off and on harrismh777 <harrismh777@charter.net> - 2011-05-14 03:05 -0500
      Re: turn monitor off and on Terry Reedy <tjreedy@udel.edu> - 2011-05-14 15:58 -0400
        Re: turn monitor off and on harrismh777 <harrismh777@charter.net> - 2011-05-14 19:25 -0500
        Re: turn monitor off and on Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-16 12:00 +1200
          Re: turn monitor off and on harrismh777 <harrismh777@charter.net> - 2011-05-15 20:48 -0500

csiph-web