How to film your screen and manipulate the picture with code

i have this code in python to do videocapture:

#videocapture(0=webcam, 1= firstcamera connected to computer 2= second camera... or'path name')
capture = cv.VideoCapture('gamepictures/Fundamentals 1.mp4')

while True:
    #isTrue =wether capture was succesful or not)
    isTrue, frame =
    frame_resized = rescaleFrame(frame)
    cv.imshow('Video', frame_resized)
    #     0xFF = if key 'd' is pressed
    if cv.waitKey(10) & 0xFF==ord('d'):
#release capture pointer
#when no more frame = error -215

but i want to film my desktop live, how can i manage that?
Note that i have Ubuntu 20.04