GithubHelp home page GithubHelp logo

hanxinyumeng / screenshot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from septemberhx/screenshot

0.0 1.0 0.0 7.89 MB

A screenshot module for Python based on PyQt5

License: GNU General Public License v3.0

Python 100.00%

screenshot's Introduction

A Screenshot module that supports modification during taking the screenshot

A screenshot module writen in python with pyQt5.

It supports:

Flag Description
pyqt_screenshot.constant.RECT tool for drawing rectangle
pyqt_screenshot.constant.ELLIPSE tool for drawing ellipse
pyqt_screenshot.constant.LINE tool for drawing line
pyqt_screenshot.constant.FREEPEN tool for drawing freely
pyqt_screenshot.constant.TEXT tool for adding text
pyqt_screenshot.constant.ARROW tool for drawing arrow
pyqt_screenshot.constant.CLIPBOARD tool for saving to clipboard
pyqt_screenshot.constant.SAVE_TO_FILE tool for saving to file

You can take some simple changes after taking a screenshot without opening an image editor.

Save image as png or jpg file, or cpoy to clipboard

Usage

from pyqt_screenshot.screenshot import Screenshot, constant

img = Screenshot.take_screenshot(constant.CLIPBOARD)  # QImage or None

None will be returned if canceled.

import sys

from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QApplication, QLabel
from pyqt_screenshot.screenshot import Screenshot, constant

if __name__ == "__main__":
    qtApp = QApplication(sys.argv)

    main_window = QLabel()
    img = Screenshot.take_screenshot(constant.CLIPBOARD | constant.LINE)
    main_window.show()
    if img is not None:
        main_window.setPixmap(QPixmap(img))
    qtApp.exec()

Demo

Before starting, you should make sure you have python and pyqt5 installed.

  1. git clone https://github.com/SeptemberHX/screenshot.git
  2. cd ./screenshot
  3. python ./main.py

Screenshot

Rectangle image

Ellipse image

Arrow image

Line and Pen image

Text image

Bugs

Can't save screenshot to clipboard on Linux because the clipboard on Linux only stores the reference to the picture object, which means the clipboard can't hold the screenshot after closing the screenshot.

screenshot's People

Contributors

septemberhx avatar sampleservice avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.