So basically I'm just messing around with mss (python2.7 and 3.6), and I have the following code:
import mss
import cv2
import numpy as np
with mss.mss() as sct:
mon = {'top':40,'left':0, 'width': 800, 'height': 750}
try:
img = np.array(sct.grab(mon))
cv2.imshow('Screen',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
except mss.ScreenShotError:
print(sct.get_error_details())
It should just take a screenshot and display it, but it just dies with the following information:
{'xerror_details': {'type': 0, 'serial': 405, 'error_code': 7, 'request_code': 0, 'minor_code': 0}, 'xerror': 'BadFont (invalid Font parameter)'}
What am I doing wrong?
I have read something about resources not being freed, but before that I messed around with code without the with statement, and without calling free or close, or whatever. It crashed, I did a reboot, to no avail.