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
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 = HorizontalSelectionSquareGraphicsView()
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
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
Built Distribution
Close
Hashes for pyqt_hbounding_box-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e34b0243620573475afb10b5194df9ac0b775379a3643ca98afdf2228125fc1b |
|
MD5 | 1c38e20f0aaa33f5e7662cec8bf0ec39 |
|
BLAKE2b-256 | fd6b0dd0868f0c4ebac44deefec47d066a49bfc27b9acad92586a2a5338cad56 |