Is there a way to call the windows screenshot snipping tool (win+shift+s) in python?

Question:

I’m wondering if there’s a way to active the windows screenshot snipping tool from a python program. Currently I’m using pynput to press the windows + shift + s key but I feel that there is a better way to perform this.

I’ve tried to use subprocess to call snipping tool.

subprocess.call([r'C:\WindowsSystem32SnippingTool.exe'])

It opens the actual application but it’s not the same as the windows+shift+s one.

Asked By: MJYMJY21191148

||

Answers:

SnippingTool.exe provides some command line options to control its behavior.
See How to open the SnippingTool (Win Tool) passing a parameter to start automatically?

To start taking a screenshot (as winshifts does), pass /clip as an argument to it like this.

subprocess.call([r'C:\WindowsSystem32SnippingTool.exe', '/clip'])
Answered By: kotatsuyaki
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.