Skip to main content
   __      __
  /  |    /  |
 _$$ |_   $$ |   __   _______   ______    ______
/ $$   |  $$ |  /  | /       | /      \  /      \
$$$$$$/   $$ |_/$$/ /$$$$$$$/  $$$$$$  |/$$$$$$  |
  $$ | __ $$   $$<  $$ |       /    $$ |$$ |  $$ |
  $$ |/  |$$$$$$  \ $$ \_____ /$$$$$$$ |$$ |__$$ |
  $$  $$/ $$ | $$  |$$       |$$    $$ |$$    $$/
   $$$$/  $$/   $$/  $$$$$$$/  $$$$$$$/ $$$$$$$/
                                        $$ |
                                        $$ |
                                        $$/

Welcome to my Github page! I am happy to present to you my personal project, tkcap. This is a Python script that lets you take screenshots of a Tkinter window.

Tkinter is a popular GUI toolkit for Python, and it's often used to develop desktop applications. Sometimes, you may need to take a screenshot of a Tkinter window for documentation or debugging purposes. This is where tkcap comes in handy. With just a few lines of code, you can capture a screenshot of your Tkinter window and save it as an image file.

tkcap is easy to use, and the script is designed to be lightweight and efficient. You simply import the tkcap module, create an instance of the CAP class, and call the capture method to take a screenshot. The captured screenshot can be saved in various image formats, including PNG, JPEG, and BMP.

I have thoroughly tested tkcap on different operating systems and with different versions of Python, and I am confident that it will work seamlessly for you. If you encounter any issues or have suggestions for improvement, please don't hesitate to open an issue on Github or reach out to me directly.

I hope that tkcap can be a useful tool for your Tkinter projects, and I look forward to hearing your feedback. Happy coding!

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 a tkinter window instance, passed to create a capture object
  cap.capture(FileName)    # Captures a screenshot of the tkinter window and saves it as provided FileName

  # To retrieve the x, y coordinates, width, and height of the tkinter window
  region = cap.get_region()

  # Bind a key (in this case, 'Control + g') to trigger a screenshot capture when pressed
  # Each time 'Control + g' is pressed, the screenshot will be saved as provided FileName
  master.bind('<Control-g>', lambda: cap.capture(FileName))

Metadata

Release files for tkcap 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tkcap 0.0.4
File Size Uploaded Provenance
tkcap-0.0.4.tar.gz 4.6 kB Without provenance Details

Release files / tkcap-0.0.4.tar.gz

Download URL tkcap-0.0.4.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
165e04828c143536077dfc120d44e10ed2d1f100b5b971b3469cb8eab4f570db
BLAKE2b-256 checksum
How to use checksums
6ead1c695117e831f7b6803b9d18ff5ed21d42295866a0d96e7e2bf9389d6457
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.6

Security for tkcap 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page