How to use Python to realize Mac screenshot
This article focuses on "how to use Python to achieve Mac screenshots", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to use Python to achieve Mac screenshots"!
Catalogue
Preface
Pyscreenshot
Github address
Python installation
Use case code
Screenshot effect
Summary
Preface
Recently, if I want to make a gadget, I need to take a screenshot on the Mac side. After searching the Chinese resources on the Internet, I found that some useful Python libraries already support Mac and Linux.
Pyscreenshotgithub address
Installation and use case instructions are included in the github address https://github.com/Zjvngvn/pyscreenshot
Python installs pip install pyscreenshot use case code
Screenshot of some areas of the screen (x1jiny1) upper left point, (x2jiny2) lower right screenshot:
Import pyscreenshot as ImageGrab# part of the screenim = ImageGrab.grab (bbox= (0,90, 2048, 1230)) # X1Percience Y1recinct X2recoveryYanzhisave image fileim.save ("box.png") screenshot effect
Take a screenshot of the game on the computer:
At this point, I believe you have a deeper understanding of "how to use Python to achieve Mac screenshots". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!