Grabs screenshot of a tkinter window


Keywords
screenshot, tkinter, region
License
MIT
Install
pip install wincap==2.1.5

Documentation

         (_)
__      ___ _ __   ___ __ _ _ __
\ \ /\ / / | '_ \ / __/ _` | '_ \
 \ V  V /| | | | | (_| (_| | |_) |
  \_/\_/ |_|_| |_|\___\__,_| .__/
                           | |
                           |_|

A wrapper for tkinter window for taking its screenshot.

Ghanteyyy http://github.com/ghanteyyy MIT License

Requirements and Tested Platforms

  • Python:

    • 3.x
  • Windows (32bit/64bit):

    • Windows 10

Installation

wincap is available on PyPI. You can install it through pip:

pip install wincap

Usage

import wincap

cap = wincap.CAP(master)  # master is an instance of tkinter
cap.capture(FileName)       # Capture and Save the screenshot of the tkiner window

# If you want the x_pos, y_pos, width and height of the tkinter window.
region = cap.get_region()

# If you want to bind the key so that everytime you press that key
# captures the screenshot. Here I have binded "Control g":
master.bind('<Control-g>', lambda: cap.capture(FileName))