I'm making a program that reads text from a screenshot and copies it to my clipboard, but when i try to give my variables the value i want with my mouse cords Python will quit unexpectedly with a long crash report.
I've tried to reinstall the modules i use, I've tried to run the code on my 2nd computer and i have of cause tried to find the answer on google without any luck.
When i give x1,y1,x2,y2 the values with my mouse cords it wont work, but if i instead just declare x1,y1,x2,y2 as the same values that i would have gotten with the mouse cords it works fine.
root = Tk() print("xy1") keyboard.wait('s')# wait until 'space' is pressed x1 = root.winfo_pointerx() # get the x pos from mouse y1 = root.winfo_pointery() # get the x pos from mouse print(x1,y1) keyboard.wait('s')# wait until 'space' is pressed x2 = root.winfo_pointerx() # get the x pos from mouse y2 = root.winfo_pointery() # get the y pos from mouse print(x2,y2) image = pyscreenshot.grab(bbox=(x1, y1, x2, y2)) #screenshot selected part of screen
Is there a way to get it to work or is there a better way to select the area i want?
Btw i am using macOS.