[Tutor] Writing Python Script to read battery level

ALAN GAULD alan.gauld at btinternet.com
Mon Jan 17 10:57:20 CET 2011


>     Is there a way to read the battery level using  Python?

> 
>     I am totally blind and want to write a script to  capture 
> the battery level and send it through the voice activeX so I can speak  it...

An interesting project. Unfortunately I don't know enough 
about how PCs do that kind of low level monitoring. Given that Windows 
displays the battery level in the system tray I'm assuming there will 
be a Windows API Call that can do it. If thats the case then yes you 
should be able to do that from Python via Pythonwin or ctypes.
You will need to do some searching of the Microsoft documentation.
I'd start with the MDSN web site...

It will probably take a bit of experimentation to get right but Pytthon 
is good for doing that kind of work using the interactive prompt.

Somebody else might have a more specific answer.

Alan G.



More information about the Tutor mailing list