Does anyone know how to show content on the screen (covering any window) using Ruby or Python?

using Ruby or Python, does anyone know how to draw on the screen while hiding any other window? For example, press the key and the program will show the current weather or stock quote on the screen (using the whole screen as a canvas), and then press the key again and everything will be restored to the same level as before? (such as the Mac OS X control panel).

+1


a source to share


3 answers


You can use the system toolbar (desktop widgets or something else called) API. For this you need Python or Ruby bindings. Alternatively, you can use some kind of generic gui toolkit or application framework and just create a frameless window with a transparent background. Then you need to be sure that the toolkit you choose supports the "always on top" options on your desired platform.



+4


a source


If you are on windows you can directly draw on dc desktop (device context) using win32api for example 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 it won't be very useful since it won't erase

Your best bet would be to use a transparent window or a window with a cutout area (at least on windows that are possible) or even if you cannot draw transparently on some system you can capture the current screen and display it as the background of your window, which will give a transparent effect

+2


a source


I would recommend PyGame.

+1


a source







All Articles