Python: text overlay on top of all windows includi

2019-09-11 03:52发布

问题:

I am trying to write a simple script in python that outputs text on top of all windows and fullscreen apps.

The purpose of this script is to output load average and free memory (and other useful stats) in similar fashion that Steam FPS counter works.

So far I tried pygame but as far as I can see it can only write into its own window.

As I understand I need to write directly to frame buffer?

The target OS is Linux with Nvidia card and Xorg, but I would prefer it to be hardware agnostic.

Thanks a lot!

回答1:

I am trying to do the same, and so far it worked - but I'm not sure about fullscreen apps - with PyOsd: http://python-osd.sourcearchive.com/documentation/0.2.14-5.1/index.html

Simplest example is

import pyosd
p=pyosd.osd()
p.display("Hello world!")