I am trying to use mss to capture a portion of my screen using the following code:
import mss
import cv2
import numpy as np
monitor_region = {
"top": 810,
"left": 1070,
"width": 660,
"height": 300
}
def get_frame(display_frame=False):
with mss.mss() as sct:
# Capture a single frame
img = sct.grab(monitor_region)
# Convert to NumPy array and display
frame = np.array(img)
# print(frame)
# print("frame dim = ", frame.shape)
if display_frame:
cv2.imshow("Captured Region", frame)
cv2.waitKey(0)
cv2.destroyAllWindows()
When running, my mac keeps prompting for permission and
I have to click allow for every request.
Unfortunately, this isn’t just a one-time thing, it happens for every screenshot request I make. This is not feasible when I am making multiple requests. Hence, I am looking for a way to disable this security check.
I have allowed terminal full access to the disk, and to screen and audio recording in my system settings. This still didn’t work so I am currently using pyautogui to automatically allow this, but this is still slow (takes ~0.2 seconds to get rid of) for my application.
I am expecting a solution to guide me to disable the above security check.
Is it possible to eliminate further requests?