Reputation: 101
I just want to create a screenshot with python. In the internet it's written that I need to use the pyscreenshot lib with the pillow lib. So I installed both and imported them into the py file.
Finally I came to this:
import numpy as np
import matplotlib.pyplot as plt
import pyscreenshot as ImageGrab
img = ImageGrab.grab()
plt.imshow(img, cmap='gray', interpolation='bicubic')
plt.show()
This gives me no error, however, the screenshot does not popup.
What did I do wrong here?
Upvotes: 4
Views: 8651
Reputation: 101
So i found the problem...
istead of:
import pyscreenshot as ImageGrab
i did:
from PIL import ImageGrab
thats all.
Here is my final code:
import numpy as np
import matplotlib.pyplot as plt
from PIL import ImageGrab
img = ImageGrab.grab()
plt.imshow(img, cmap='gray', interpolation='bicubic')
plt.show()
hopefully that helped you if you have the same problem as i had.
Upvotes: 6