pyqt-textbox-graphics-widget
PyQt text box which is movable, auto-resizable by text size. Parent class is QGraphicsWidget.
Requirements
- PyQt5 >= 5.8
Setup
python -m pip install pyqt-textbox-graphics-widget
Usage
You can move the box if you drag any areas near the border. If you click any areas near the middle of the box, cursor will be shown to let you write something down. Box will be auto-resized by text size. (See the result below)
Example
Code Sample
from PyQt5.QtWidgets import QApplication, QGraphicsView, QGraphicsScene, QMainWindow
from pyqt_textbox_graphics_widget import TextBoxGraphicsWidget
class DiagramMainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.__initUi()
def __initUi(self):
view = QGraphicsView()
self.__scene = QGraphicsScene()
self.__scene.setSceneRect(0, 0, 400, 400)
textBox = TextBoxGraphicsWidget()
self.__scene.addItem(textBox)
view.setScene(self.__scene)
self.setCentralWidget(view)
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
diagramMainWindow = DiagramMainWindow()
diagramMainWindow.show()
sys.exit(app.exec_())
Result
See Also
- pyqt-styled-graphics-text-item-example - This is based on
QGraphicsTextItem. In terms of usefulness,pyqt-styled-graphics-text-item-exampleis more inferior than this one.
Metadata
Release files for pyqt-textbox-graphics-widget 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyqt-textbox-graphics-widget-0.0.1.tar.gz | 3.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyqt_textbox_graphics_widget-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.0 kB
Release files / pyqt-textbox-graphics-widget-0.0.1.tar.gz
| Download URL | pyqt-textbox-graphics-widget-0.0.1.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6ffb48c9f6159c74f663474ce6ea8d6b3f7de84f5426a6bca65497da42ba137f
|
|
BLAKE2b-256 checksum How to use checksums |
ef84dcbc7b953739c0c86c52ef878469e777fc04dbd7e53f1936d08171679538
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/0.0.0 CPython/3.7.6
|
Release files / pyqt_textbox_graphics_widget-0.0.1-py3-none-any.whl
| Download URL | pyqt_textbox_graphics_widget-0.0.1-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
135a78c89c2bc28cdc13c8caf180e2aabedfb720254fca433bc45e98564012c7
|
|
BLAKE2b-256 checksum How to use checksums |
11497305cc70a86054bd7863c6ea40d853555864ab28955bbffab1dca92d8784
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/0.0.0 CPython/3.7.6
|