Skip to main content

PyQt bounding box for graphic design software

Project description

pyqt-bounding-box

PyQt bounding box for graphic design software

Requirements

PyQt5 >= 5.8

Setup

python -m pip install pyqt-bounding-box

Feature

  • Cursor shape changes properly for position (horizontal/vertical edge, etc.)

  • Being able to resize the box horizontally/vertically/diagonally

  • Being able to move the box with either mouse cursor or arrow keys

  • Being able to change the line width of box with setLineWidth(n: int)

Example

Code Sample

from PyQt5.QtWidgets import QWidget, QGraphicsView, QVBoxLayout, QApplication, QGraphicsScene



from pyqt_bounding_box.boundingBox import BoundingBox





class Example(QWidget):

    def __init__(self):

        super().__init__()

        self.__initUi()



    def __initUi(self):

        view = QGraphicsView()

        self.__scene = QGraphicsScene()

        self.__scene.setSceneRect(0, 0, 400, 400)



        item = BoundingBox()

        # item.setLineWidth(8) If you want to change the edge line width, add the code.

        self.__scene.addItem(item)

        view.setScene(self.__scene)



        lay = QVBoxLayout()

        lay.addWidget(view)



        self.setLayout(lay)





if __name__ == "__main__":

    import sys



    app = QApplication(sys.argv)

    example = Example()

    example.show()

    app.exec_()

Result

https://user-images.githubusercontent.com/55078043/148708740-cd1f0765-7768-44b6-88bb-770e2d34fe12.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-bounding-box-0.0.11.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

pyqt_bounding_box-0.0.11-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pyqt-bounding-box-0.0.11.tar.gz
Algorithm Hash digest
SHA256 2cdc67a74b91b6f56be28aa1df187677069c2407b04ab8dd48b6524fc4b45cb1
MD5 26ebc763f999221a9a06b0d52120a6e8
BLAKE2b-256 b373fde6daec65a34a97d670b853914731d71a834c643f60bac7942641c73791

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqt_bounding_box-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 d4f80468016010f4d1403a3cfa14bceb86e061d8c2e14a0bb40e827f6609c8e1
MD5 8fbabc30189213b48cf1ca7d3623838a
BLAKE2b-256 bce689e3859fbd4cc318061683454ac50c89c15af970a833c415300ee8fb1f00

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