How we can prevent screen recording

After searching for hours, I have no choice left to ask some python gurus. I want to prevent a user to capture my app window.

I’m currently using tinker. I’m also aware of the C# but I want to do it in python.

I hope there will be SetwindowDisplayAffinity alternative in python. Your reply will be appreciated.

Please note I’m currently new to python.

I think that the fact that your search (for hours) has proven fruitless, speaks for itself: it can’t be prevented.

Even if you jump through the technical hoops required, what’s to prevent a user simply setting up a camera and recording the screen?

Or am I misunderstanding your question?

The common way of making win32 API calls in Python is through the pywin32 library:

If a particular call is missing (I think it is the case of SetwindowDisplayAffinity) then you can use ctypes from the standard library:

@rob42 through the SetwindowDisplayAffinity call you should be able to create a region on screen which will appear black in screenshots. Certainly there are ways how to circumvent it: running the Windows OS in a VM, HDMI recorder, recording using a camera and probably many more.