views:

193

answers:

2

I know this is a long shot, but I was wondering if Python had a way to manipulate the screen buffer. Specifically, I want to be able to gray-out my desktop and highlight my windows when I press a key combination. Is this in the realm of possibility?

+2  A: 

From your question and the comments that followed, PyQt would be a good choice, you would have a common code for the three platforms.

You have to develop it as a GUI though, using the library functions, it also means you will have to rethink what you exactly want in terms of GUI possibilities, and in a way that respects the usual GUI conventions: users probably don't want your application to modify their favourite desktop background or to behave weirdly.

For example, there is a way to bring your application to the foreground (the examples given in answer are in C++ but equivalent methods are available in Python and the code would be very similar).

Qt is originally a C++ framework, recently acquired by Nokia, if you are also familiar with that language you should think it over before deciding which to choose, but in any case PyQt will not let you down, it is quite mature and stable.

Regarding the license, in case it's one of your concerns, PyQt is GPL and a commercial license is also available. Another Python Qt porting is in the works with a LGPL license, pushed by Nokia following the refusal from the PyQt author to change their license: PySide, but it is still in its early development.

Finally, I have to mention that Qt isn't the only GUI framework for Python, by searching you will find other questions related to that topic on SO, with other suggestions:

RedGlyph
+1  A: 

Instead of "graying out" the desktop, try to overlay a gray, semi-transparent image over the entire screen and then make sure your window is on top of that. You may face a couple of minor limitations; for example, I don't know off the top of my head if it's possible to overlay the mac menubar (and I'm not sure you'd want to).

Bryan Oakley