Skip to main content

PyQt QGraphicsView with bounding box. User can move vertical border of the box horizontally.

Project description

pyqt-hbounding-box

PyQt QGraphicsView with bounding box. User can move vertical border of the box horizontally.

Requirements

PyQt5 >= 5.8

Setup

python -m pip install pyqt-hbounding-box

Feature

  • Being able to drag and drop vertical border horizontally

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

  • Right click to release the focus of the box

  • You can set the background out of the box darker with setDarkerOutOfBox(f: bool).

Example

Code Sample

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



from pyqt_hbounding_box.hboundingBox import HBoundingBox





class HBoundingBoxExample(QWidget):

    def __init__(self):

        super().__init__()

        self.__initUi()



    def __initUi(self):

        addImageBtn = QPushButton('Add image')

        addImageBtn.clicked.connect(self.__addImage)

        self.__view = HBoundingBox()



        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 = HBoundingBoxExample()

    ex.show()

    sys.exit(app.exec_())

Result

https://user-images.githubusercontent.com/55078043/147186296-fa9083d0-67c6-4d7e-b139-7845ee38ddf9.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-hbounding-box-0.0.13.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

pyqt_hbounding_box-0.0.13-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file pyqt-hbounding-box-0.0.13.tar.gz.

File metadata

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

File hashes

Hashes for pyqt-hbounding-box-0.0.13.tar.gz
Algorithm Hash digest
SHA256 694c38f8c3c79525ea8edb81e41fcb608d4339c43837f725f4133edb4c967553
MD5 d8766ebf8a4b50466b9b8412ea63df85
BLAKE2b-256 b8ca8fd84cdfa3b7a8e200beb3bb0c1679f7c762a4f8070a02e6b7eef2956e91

See more details on using hashes here.

File details

Details for the file pyqt_hbounding_box-0.0.13-py3-none-any.whl.

File metadata

File hashes

Hashes for pyqt_hbounding_box-0.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 7593a4c6ed490e978c08d63a1659151ad21da80294d5684903ae64e46c7ac7ef
MD5 0a2d1a8ed8889a0dbd2b216daeb08112
BLAKE2b-256 ceef5fd9b80acb9c056a1e7af38bacd5841820d8f962d4d10572254480caa2f9

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