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
See Also
-
pyqt-vbounding-box - vertical way
-
pyqt-bounding-box - horizontal/vertical ways
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
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 694c38f8c3c79525ea8edb81e41fcb608d4339c43837f725f4133edb4c967553 |
|
MD5 | d8766ebf8a4b50466b9b8412ea63df85 |
|
BLAKE2b-256 | b8ca8fd84cdfa3b7a8e200beb3bb0c1679f7c762a4f8070a02e6b7eef2956e91 |
File details
Details for the file pyqt_hbounding_box-0.0.13-py3-none-any.whl
.
File metadata
- Download URL: pyqt_hbounding_box-0.0.13-py3-none-any.whl
- Upload date:
- Size: 5.1 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 | 7593a4c6ed490e978c08d63a1659151ad21da80294d5684903ae64e46c7ac7ef |
|
MD5 | 0a2d1a8ed8889a0dbd2b216daeb08112 |
|
BLAKE2b-256 | ceef5fd9b80acb9c056a1e7af38bacd5841820d8f962d4d10572254480caa2f9 |