Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yjg30737/pyqt-textbox-graphics-widget
PyQt text box which is movable, auto-resizable by text size. Parent class is QGraphicsWidget.
https://github.com/yjg30737/pyqt-textbox-graphics-widget
pyqt pyqt-examples pyqt5 pyqt5-examples pyqt5-gui pyqt5-tutorial qbrush qgradient qgraphicsgridlayout qgraphicsscene qgraphicsview qgraphicswidget qpainter qpen qt qtextbrowser
Last synced: 12 days ago
JSON representation
PyQt text box which is movable, auto-resizable by text size. Parent class is QGraphicsWidget.
- Host: GitHub
- URL: https://github.com/yjg30737/pyqt-textbox-graphics-widget
- Owner: yjg30737
- License: mit
- Created: 2022-02-09T12:40:33.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-05-13T22:28:34.000Z (over 2 years ago)
- Last Synced: 2024-11-15T12:58:24.978Z (about 1 month ago)
- Topics: pyqt, pyqt-examples, pyqt5, pyqt5-examples, pyqt5-gui, pyqt5-tutorial, qbrush, qgradient, qgraphicsgridlayout, qgraphicsscene, qgraphicsview, qgraphicswidget, qpainter, qpen, qt, qtextbrowser
- Language: Python
- Homepage:
- Size: 12.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
```python
from PyQt5.QtWidgets import QApplication, QGraphicsView, QGraphicsScene, QMainWindow
from pyqt_textbox_graphics_widget import TextBoxGraphicsWidgetclass 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 sysapp = QApplication(sys.argv)
diagramMainWindow = DiagramMainWindow()
diagramMainWindow.show()
sys.exit(app.exec_())
```Result
https://user-images.githubusercontent.com/55078043/153204254-cd5776c3-54c3-47a5-9285-98229b0376b1.mp4
## See Also
* pyqt-styled-graphics-text-item-example - This is based on ```QGraphicsTextItem```. In terms of usefulness, ```pyqt-styled-graphics-text-item-example``` is more inferior than this one.