Python Forum
How we can prevent screen recording
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How we can prevent screen recording
#4
You can try this, but renaming the name of the application breaks it.

from tkinter import Tk, Label, Button
from tkinter.messagebox import showwarning

# pip install psutil
from psutil import process_iter


def recording_observer(root):
    forbidden = ["obs.exe", "obs64.exe"]
    
    for process in process_iter():
        if process.name() in forbidden:
            root.withdraw()
            showwarning("Recoding", "Recording is not allowed")
            break
    else:
        root.deiconify()

    root.after(1_000, lambda: recording_observer(root))


root = Tk()
Label(root, text="Hello World").pack()
Button(root, text="Close", command=root.destroy).pack()

recording_observer(root)

root.mainloop()
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
How we can prevent screen recording - by murad_ali - Jul-27-2022, 09:11 AM
RE: How we can prevent screen recording - by DeaD_EyE - Jul-29-2022, 10:29 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Using SQLAlchemy, prevent SQLite3 table update by multiple program instances Calab 3 936 Aug-09-2023, 05:51 PM
Last Post: Calab
  Video recording with Raspberry Pi - What´s wrong with my python code? Montezuma1502 3 1,476 Feb-24-2023, 06:14 PM
Last Post: deanhystad
  How to prevent python from going to new line in for loop? idknuttin 3 5,210 Feb-11-2022, 05:40 AM
Last Post: deanhystad
  How to decrease latency while recording streaming video. unicorn2019 0 1,343 Nov-15-2021, 02:12 PM
Last Post: unicorn2019
  Help with storing temp data for each day then recording min/max in app. trthskr4 3 2,582 Sep-10-2021, 10:51 PM
Last Post: trthskr4
  Split recording with Picamera EvanS1 0 2,058 Jun-19-2021, 12:26 PM
Last Post: EvanS1
  Prevent urllib.request from using my local proxy spacedog 0 3,059 Apr-24-2021, 08:55 PM
Last Post: spacedog
  Using pyaudio to stop recording under certain sound threshold Twanski94 2 6,816 Jun-13-2020, 11:35 AM
Last Post: Twanski94
  Prevent a PDF from being edited using Python? PythonNPC 1 2,429 May-05-2020, 09:04 PM
Last Post: micseydel
  recording a translation table into a file arbiel 0 1,557 Mar-31-2020, 02:33 PM
Last Post: arbiel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020