22.8 C
New York
Thursday, June 5, 2025

Can I cease macOS asking for display screen recording permission whereas utilizing mss.mss() in a python script?


I’m attempting to make use of mss to seize a portion of my display screen utilizing the next code:

import mss
import cv2
import numpy as np

monitor_region = {
    "high": 810,
    "left": 1070,
    "width": 660,
    "peak": 300
}


def get_frame(display_frame=False):
    with mss.mss() as sct:
        # Seize a single body
        img = sct.seize(monitor_region)

        # Convert to NumPy array and show
        body = np.array(img)
        # print(body)
        # print("body dim = ", body.form)

        if display_frame:
            cv2.imshow("Captured Area", body)
            cv2.waitKey(0)
            cv2.destroyAllWindows()

When operating, my mac retains prompting for permission and
I’ve to click on enable for each request.

Can I cease macOS asking for display screen recording permission whereas utilizing mss.mss() in a python script?

Sadly, this is not only a one-time factor, it occurs for each screenshot request I make. This isn’t possible when I’m making a number of requests. Therefore, I’m on the lookout for a option to disable this safety test.

I’ve allowed terminal full entry to the disk, and to display screen and audio recording in my system settings. This nonetheless did not work so I’m at the moment utilizing pyautogui to routinely enable this, however that is nonetheless sluggish (takes ~0.2 seconds to eliminate) for my software.

I’m anticipating an answer to information me to disable the above safety test.

Is it doable to get rid of additional requests?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles