Skip to main content

Grabs screenshot of a tkinter window

Project description

   __      __
  /  |    /  |
 _$$ |_   $$ |   __   _______   ______    ______
/ $$   |  $$ |  /  | /       | /      \  /      \
$$$$$$/   $$ |_/$$/ /$$$$$$$/  $$$$$$  |/$$$$$$  |
  $$ | __ $$   $$<  $$ |       /    $$ |$$ |  $$ |
  $$ |/  |$$$$$$  \ $$ \_____ /$$$$$$$ |$$ |__$$ |
  $$  $$/ $$ | $$  |$$       |$$    $$ |$$    $$/
   $$$$/  $$/   $$/  $$$$$$$/  $$$$$$$/ $$$$$$$/
                                        $$ |
                                        $$ |
                                        $$/

A wrapper for tkinter window for taking its screenshot.

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

Requirements and Tested Platforms

  • Python:

    • 3.x
  • Windows:

    • Windows 10 & 11

Installation

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

pip install tkcap

Usage

  import tkcap

  cap = tkcap.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 to "Control g"
  master.bind('<Control-g>', lambda: cap.capture(FileName))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tkcap-0.0.3.tar.gz (3.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page