From 10ec79b2293b1c73d04fde80c1edb1d46a69ed80 Mon Sep 17 00:00:00 2001 From: NiiightmareXD Date: Thu, 14 Nov 2024 13:41:16 +0330 Subject: [PATCH] =?UTF-8?q?Bug=20fix=20=F0=9F=90=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- windows-capture-python/Cargo.toml | 2 +- windows-capture-python/README-Python.md | 79 +++++++++++++++++++++++++ windows-capture-python/pyproject.toml | 2 +- 3 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 windows-capture-python/README-Python.md diff --git a/windows-capture-python/Cargo.toml b/windows-capture-python/Cargo.toml index d71b4b4..22da2b5 100644 --- a/windows-capture-python/Cargo.toml +++ b/windows-capture-python/Cargo.toml @@ -4,7 +4,7 @@ version = "1.4.2" authors = ["NiiightmareXD"] edition = "2021" description = "Fastest Windows Screen Capture Library For Python 🔥" -readme = "README.md" +readme = "README-Python.md" repository = "https://github.com/NiiightmareXD/windows-capture/tree/main/windows-capture-python" license = "MIT" keywords = ["screen", "capture", "screenshot", "graphics", "windows"] diff --git a/windows-capture-python/README-Python.md b/windows-capture-python/README-Python.md new file mode 100644 index 0000000..81167d3 --- /dev/null +++ b/windows-capture-python/README-Python.md @@ -0,0 +1,79 @@ +# Windows Capture   [![Licence]][Licence URL] [![Build Status]][repository] [![Latest Version]][pypi.org] + +[Licence]: https://img.shields.io/crates/l/windows-capture +[Licence URL]: https://github.com/NiiightmareXD/windows-capture/blob/main/windows-capture-python/LICENCE + +[Build Status]: https://img.shields.io/github/actions/workflow/status/NiiightmareXD/windows-capture/rust.yml +[repository]: https://github.com/NiiightmareXD/windows-capture/tree/main/windows-capture-python + +[Latest Version]: https://img.shields.io/pypi/v/windows-capture +[pypi.org]: https://pypi.org/project/windows-capture + +**Windows Capture** is a highly efficient Rust and Python library that enables you to capture the screen using the Graphics Capture API effortlessly. This library allows you to easily capture the screen of your Windows-based computer and use it for various purposes, such as creating instructional videos, taking screenshots, or recording your gameplay. With its intuitive interface and robust functionality, Windows Capture is an excellent choice for anyone looking for a reliable, easy-to-use screen-capturing solution. + +**Note** this README.md is for [Python library](https://github.com/NiiightmareXD/windows-capture/tree/main/windows-capture-python) Rust library can be found [here](https://github.com/NiiightmareXD/windows-capture) + +## Features + +- Only Updates The Frame When Required. +- High Performance. +- Easy To Use. +- Latest Screen Capturing API. + +## Installation + +Run this command + +``` +pip install windows-capture +``` + +## Usage + +```python +from windows_capture import WindowsCapture, Frame, InternalCaptureControl + +# Every Error From on_closed and on_frame_arrived Will End Up Here +capture = WindowsCapture( + cursor_capture=None, + draw_border=None, + monitor_index=None, + window_name=None, +) + + +# Called Every Time A New Frame Is Available +@capture.event +def on_frame_arrived(frame: Frame, capture_control: InternalCaptureControl): + print("New Frame Arrived") + + # Save The Frame As An Image To The Specified Path + frame.save_as_image("image.png") + + # Gracefully Stop The Capture Thread + capture_control.stop() + + +# Called When The Capture Item Closes Usually When The Window Closes, Capture +# Session Will End After This Function Ends +@capture.event +def on_closed(): + print("Capture Session Closed") + + +capture.start() +``` + +## Benchmark + +Windows Capture Is The Fastest Python Screen Capture Library + +![Benchmark Showing Windows Capture Is The Fastest Python Screen Capture Library](https://github.com/NiiightmareXD/windows-capture/assets/90005793/444fa93e-5e27-48c8-8eb6-b9e21ab26452) + +## Contributing + +Contributions are welcome! If you find a bug or want to add new features to the library, please open an issue or submit a pull request. + +## License + +This project is licensed under the [MIT License](LICENSE). diff --git a/windows-capture-python/pyproject.toml b/windows-capture-python/pyproject.toml index 0657fd6..d3725bd 100644 --- a/windows-capture-python/pyproject.toml +++ b/windows-capture-python/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "maturin" name = "windows-capture" version = "1.4.2" description = "Fastest Windows Screen Capture Library For Python 🔥" -readme = "README.md" +readme = "README-Python.md" requires-python = ">=3.9" license = "MIT" authors = [{ name = "NiiightmareXD" }]