PyQt bounding box for graphic design software
Project description
pyqt-bounding-box
PyQt bounding box for graphic design software
Requirements
PyQt5 >= 5.8
Setup
pip3 install git+https://github.com/yjg30737/pyqt-selection-box.git --upgrade
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
Note
BoundingBox
class inherits QGraphicsRectItem
.
Default line width value is 3.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyqt-bounding-box-0.0.1.tar.gz
.
File metadata
- Download URL: pyqt-bounding-box-0.0.1.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 389239678281ab38143c783e83d46256b53020183d6842740ebb91d0dd6696e0 |
|
MD5 | be2433cd4eba8610e766bfd8b5c0af50 |
|
BLAKE2b-256 | 5c2e072b6075bb845cc0b4e1a3cfb9bb9a9f9c64f067f7da87fda1ddea56fd94 |
File details
Details for the file pyqt_bounding_box-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: pyqt_bounding_box-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/0.0.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5102686a91d5f887ccf55730aeba8d9246c59ceb87f3d535213581b666258d8e |
|
MD5 | 2205e0657cbfc3f0ce61af9939499556 |
|
BLAKE2b-256 | f1389d3d2693314877f62ace39b14edb0ce810278abb46200fb8914103623488 |