[Tutor] Writing Python Script to read battery level

2011-01-17 Thread FT
Allan, 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... Bruce ___ Tutor maillist - Tutor@py

Re: [Tutor] Writing Python Script to read battery level

2011-01-17 Thread ALAN GAULD
> 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 o

Re: [Tutor] Writing Python Script to read battery level

2011-01-17 Thread Tim Golden
On 17/01/2011 03:01, FT wrote: 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... WMI should be able to query the battery information: import wmi c = wmi

Re: [Tutor] Writing Python Script to read battery level

2011-01-17 Thread python
FT, > Is there a way to read the battery level using Python? Check out the following code snippet: Get info on power/battery status http://nullege.com/codes/show/src@jaraco.windows-1.6@jaraco@wind...@power.py/14/ctypes.wintypes.BOOL This code snippet requires the following 3rd party packages:

Re: [Tutor] question about manipulate images!

2011-01-17 Thread Elwin Estle
--- On Sun, 1/16/11, zhengqing gan wrote: > From: zhengqing gan > Subject: [Tutor] question about manipulate images! > To: tutor@python.org > Date: Sunday, January 16, 2011, 11:37 PM > Hi, All: >      I have a question about > manipulating images. >      If I have a image, is there a kind > of

Re: [Tutor] question about manipulate images!

2011-01-17 Thread Alan Gauld
"zhengqing gan" wrote I have a question about manipulating images. In Python that usually translates to use PIL... If I have a image, is there a kind of algorithm to convert it into kind of Iphone icon style? part transparent, gradient PIL can do most of that but you will need

Re: [Tutor] Refcount in C extensions

2011-01-17 Thread Izz ad-Din Ruhulessin
Hi Steve, Your remarks about Cython pushed me over the edge into the Unknown, this weekend I decided to download it and check it out. I've been using it the past few days and it totally rocks. It really feels like I was chained before and now I'm not; like where some simple Python operations coul

Re: [Tutor] question about manipulate images!

2011-01-17 Thread zhengqing gan
Hi, Thanks for the reply. But I found that there are some website which can convert images into iphone icon style images, there should be an kind of algorithm to manipulate. Thanks! On Mon, Jan 17, 2011 at 3:33 AM, Elwin Estle wrote: > > > --- On Sun, 1/16/11, zhengqing gan wrote: > >>

Re: [Tutor] question about manipulate images!

2011-01-17 Thread Eduardo Vieira
Hi. Try to find a tutorial on the steps to achieve such effect in a graphic program. Then map it to the scrpting steps to do the same with pil, python for gimp, for inkscape or simply Imagemagick. On 2011-01-17 8:37 AM, "zhengqing gan" wrote: Hi, Thanks for the reply. But I found that there

Re: [Tutor] Writing Python Script to read battery level

2011-01-17 Thread Bill Allen
Tim, Thanks for posting this. I have several uses for this WMI module at my work. --Bill On Mon, Jan 17, 2011 at 04:07, Tim Golden wrote: > On 17/01/2011 03:01, FT wrote: > >> Is there a way to read the battery level using Python? >> >> I am totally blind and want to write a script to

Re: [Tutor] Writing Python Script to read battery level

2011-01-17 Thread Tim Golden
On 17/01/2011 18:35, Bill Allen wrote: Tim, Thanks for posting this. I have several uses for this WMI module at my work. Glad it's useful... TJG ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.pyt

Re: [Tutor] question about manipulate images!

2011-01-17 Thread Corey Richardson
On 01/17/2011 10:34 AM, zhengqing gan wrote: > Hi, >Thanks for the reply. >But I found that there are some website which can convert images > into iphone icon style images, there should be an kind of algorithm to > manipulate. >Thanks! > > >From playing with http://wizardtoolkit.com/

[Tutor] Exactly duplicating strftime behavior?

2011-01-17 Thread Izz ad-Din Ruhulessin
Hi all, I'm designing a module which aims to provide full compatibility with Pythons' datetime module. However, I can't find out how some operators in strftime function, namely: those who use the locale. (%a, %A, %b, etc.) How do I access this locale and it's values? Thanks in advance. Kind re

[Tutor] What is __weakref__ ?

2011-01-17 Thread Karim
Hello, I am wondering what is this special class attribut. I know __dict__, slots. I use slots = [] when I want to use a read only class. But is anyone could explain with a little example the use of __weakref__? Regards karim ___ Tutor maillist -

[Tutor] Why super does not work !

2011-01-17 Thread Karim
Hello, I implemented Observer DP on a listbox (Tkinter) as follows and I don't understand why super() is not working and Observable.__init__(self) is working, cf below: class ListObservable(Listbox, Observable): """Creation de widget Listbox""" def __init__(self): super(List

Re: [Tutor] Why super does not work !

2011-01-17 Thread Izz ad-Din Ruhulessin
It looks like because of something Observable doesn't have that attribute. Could you post the ListBox class? 2011/1/17 Karim > > > Hello, > > I implemented Observer DP on a listbox (Tkinter) as follows and I don't > understand why super() is not working and Observable.__init__(self) is > working

Re: [Tutor] What is __weakref__ ?

2011-01-17 Thread Steven D'Aprano
Karim wrote: Hello, I am wondering what is this special class attribut. I know __dict__, slots. I use slots = [] when I want to use a read only class. (1) slots = [] doesn't do anything special. You have misspelled __slots__. (2) Classes don't become read only just because you add __slots_

Re: [Tutor] Why super does not work !

2011-01-17 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Karim wrote: Hello, I implemented Observer DP on a listbox (Tkinter) as follows and I don't understand why super() is not working and Observable.__init__(self) is working, cf below: class ListObservable(Listbox, Observable): """Creation de widget Listbox""" def __in

Re: [Tutor] Why super does not work !

2011-01-17 Thread Luke Paireepinart
I think it might be related to your multiple inheritance, maybe super is calling the init of observable on the listbox portion or something? I hardly ever do multiple inheritance so I'm not sure. What happens if you swap observable to be the first one? - Sent from a

Re: [Tutor] Exactly duplicating strftime behavior?

2011-01-17 Thread Hugo Arts
On Mon, Jan 17, 2011 at 8:29 PM, Izz ad-Din Ruhulessin wrote: > Hi all, > I'm designing a module which aims to provide full compatibility with > Pythons' datetime module. > However, I can't find out how some operators in strftime function, namely: > those who use the locale. (%a, %A, %b, etc.) > H

Re: [Tutor] Why super does not work !

2011-01-17 Thread Steven D'Aprano
Karim wrote: Hello, I implemented Observer DP on a listbox (Tkinter) as follows and I don't understand why super() is not working and Observable.__init__(self) is working, cf below: You seem to be confused about your class design. On the one hand, you inherit from Listbox, but then you *a

Re: [Tutor] Why super does not work !

2011-01-17 Thread Alan G
Steven D'Aprano pearwood.info> writes: > fact that multiple inheritance itself is often the wrong thing to use, > and even when it is right, it is often tricky to get it right. To put it > another way: don't use multiple inheritance unless you have to, there > are better ways, such as by compo

Re: [Tutor] Why super does not work !

2011-01-17 Thread Karim
Thanks Izz, Luke, Steven and Alan! That's I figured out with MI and super. Steven I understand the point to have Listbox contains a Listbox. Before the code was in App class and I extracted it to do an outside class making the mistake. But magic of Python it's working (but I know it's awful). T

Re: [Tutor] Exactly duplicating strftime behavior?

2011-01-17 Thread Izz ad-Din Ruhulessin
Hi Hugo, Problem solved, thanks! Kind regards, Izz ad-Din 2011/1/17 Hugo Arts > On Mon, Jan 17, 2011 at 8:29 PM, Izz ad-Din Ruhulessin > wrote: > > Hi all, > > I'm designing a module which aims to provide full compatibility with > > Pythons' datetime module. > > However, I can't find out how