tags:

views:

98

answers:

3

using Ruby or Python, does someone know how to draw on the screen, covering up any other window? Kind of like, press a key, and the program will show current weather or stock quote on the screen (using the whole screen as the canvas), and then press the key again, and everything restores to the same as before? (like Mac OS X's dash board).

+4  A: 

You could use the systems dashboard (desktop widgets, or whatever it's called) API. In order to do that you need bindings to it for Python or Ruby. Alternatively you could use some generic gui toolkit or application framework and just create a frameless window with transparent background. Then you need to be sure that the chosen toolkit supports 'always-on-top' options on your desired platform(s).

Maleev
+1  A: 

If you are on windows you can directly draw to desktop dc(device context) using win32api e.g. just for fun try this :)

>>> import win32ui
>>> import win32gui
>>> hdc = win32ui.CreateDCFromHandle( win32gui.GetDC( 0 ) )
>>> hdc.DrawText("Wow it works", (100, 100, 200, 200))
>>> hdc.LineTo(500,500)

but that won't be very useful ,as not erasable

best bet would be to use a transparent window or window with a cutout region (atleast on windows that is possible) or even if you can't draw transparent on some system you can grab the current screen and display it as background of you window that would give a transparent effect

Anurag Uniyal
"""you can grab the current screen"""- Then how do you know if, say, some other window below it moves, which is logically _below_ our window, so the system won't call for repaint?
Maleev
+1  A: 

I would recommend PyGame.

John Douthat