Draw rectangle over other applications' control elements

How do I write python code to draw (red) rectangle over control elements in other applications ?
For example, draw a red box around the digit 0, 1, 2,…9 of a window calculator application.

I understand I may need to create an overlay (transparent) window over the size of the control element in other applications, and then draw on this overlay window.

But not sure which library and what functions to use to create the overlay,

and if removing / deleting this overlay window achieve the objective of removing any drawing that overlays on the control elements ?


Hi Raymond,

windows of other applications are under the sole control of the window manager of the operating system.

Under Windows you might get the window handle of said application window by using the library pywin32.

Have a look at this:

winapi - pywin32: how to get window handle from process handle and vice versa - Stack Overflow

Cheers, Dominik