Skip to main content

PyQt QGraphicsView with bounding box. User can move horizontal border of the box vertically.

Project description

pyqt-vbounding-box

PyQt QGraphicsView with bounding box. User can move horizontal border of the box vertically.

Requirements

  • PyQt5 >= 5.8

Setup

python -m pip install pyqt-vbounding-box

Feature

  • Being able to drag and drop horizontal border vertically

  • Pressing mouse cursor to place more adjacent border on the spot.

  • Right click to release the focus of the box

Example

Code Sample

from PyQt5.QtWidgets import QWidget, QGridLayout, QApplication, QPushButton, QFileDialog



from pyqt_vbounding_box.vBoundingBox import VBoundingBox





class VBoundingBoxExample(QWidget):

    def __init__(self):

        super().__init__()

        self.__initUi()



    def __initUi(self):

        addImageBtn = QPushButton('Add image')

        addImageBtn.clicked.connect(self.__addImage)

        self.__view = VBoundingBox()



        lay = QGridLayout()

        lay.addWidget(addImageBtn)

        lay.addWidget(self.__view)



        self.setLayout(lay)



    def __addImage(self):

        filename = QFileDialog.getOpenFileName(self, 'Open', '', 'Image Files (*.png *.jpg *.bmp)')

        if filename[0]:

            filename = filename[0]

            self.__view.setFile(filename)





if __name__ == "__main__":

    import sys



    app = QApplication(sys.argv)

    ex = VBoundingBoxExample()

    ex.show()

    sys.exit(app.exec_())

Result

https://user-images.githubusercontent.com/55078043/157777737-a801f085-936e-4f08-95bc-9ae51313454a.mp4

See Also

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

pyqt-vbounding-box-0.0.11.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

pyqt_vbounding_box-0.0.11-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file pyqt-vbounding-box-0.0.11.tar.gz.

File metadata

  • Download URL: pyqt-vbounding-box-0.0.11.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/0.0.0 CPython/3.7.6

File hashes

Hashes for pyqt-vbounding-box-0.0.11.tar.gz
Algorithm Hash digest
SHA256 ef3059d53f88fe620643003b6b65ec069448d249b08bea9b3f40133644723222
MD5 10d1525cff977f6a3c462e7704f36a29
BLAKE2b-256 e73d5430e49ed71351faf4ab298366b30438ee0bd19ba8c68e9b39ae7e0d797b

See more details on using hashes here.

File details

Details for the file pyqt_vbounding_box-0.0.11-py3-none-any.whl.

File metadata

File hashes

Hashes for pyqt_vbounding_box-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 289468648b6da50dda26483ddc633d77ceaf1c57170c9f28d8ac3c8f45d296bf
MD5 7b6a441504142534826b3b2d46ef01c5
BLAKE2b-256 f054b5cc3863af1a83485797dab5ec7c53a5d2a26184dfe15146560a15a7ab0f

See more details on using hashes here.

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