pyqt-explanation-balloon
PyQt explanation balloon
Requirements
- PyQt5 >= 5.8
Setup
python -m pip install pyqt-explanation-balloon
Preview
Explanation balloon can be used to explain certain widget. You can close this balloon with X button at the top right.
You can set the widget which you want to describe with balloon.
You can also set the size and content of balloon with constructor. Check the class overview below.
This explanation balloon is perfectly responsive to window's resize/move/activate/deactivate event.
Text alignment is set to the center, word is wrapped at word boundaries.
Class/Method Overview
-
ExplanationBalloon(widget, width: float, height: float, text: str)- Constructor.widgetis the widget which is supposed to be explained by explanation balloon. -
setBackgroundColor(color: QColor)- Set the background color. Text color will be also changed automatically based on background color. -
setFont(font: QFont)- Default function of Qt. You can set the font of text.
Example
from PyQt5.QtGui import QFont, QColor
from PyQt5.QtWidgets import QMainWindow, QPushButton, QApplication, QVBoxLayout, QWidget
from pyqt_explanation_balloon.explanationBalloon import ExplanationBalloon
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.__initUi()
def __initUi(self):
btn = QPushButton('Show explanation balloon')
lay = QVBoxLayout()
lay.addWidget(btn)
mainWidget = QWidget()
mainWidget.setLayout(lay)
self.setCentralWidget(mainWidget)
self.__eb = ExplanationBalloon(btn, 300.0, 200.0, 'This is explanation balloon made out of PyQt')
self.__eb.setFont(QFont('Arial', 14))
self.__eb.setBackgroundColor(QColor(50, 50, 50, 255))
btn.clicked.connect(self.__eb.show)
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
mainWindow = MainWindow()
mainWindow.show()
sys.exit(app.exec_())
Result
Release files for pyqt-explanation-balloon 0.0.21
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-explanation-balloon-0.0.21.tar.gz | 4.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyqt_explanation_balloon-0.0.21-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.5 kB
Release files / pyqt-explanation-balloon-0.0.21.tar.gz
| Download URL | pyqt-explanation-balloon-0.0.21.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
396e5df61df40c3e6f24a73e34920ea30b64c4c354224660070f9ade5fa17b19
|
|
BLAKE2b-256 checksum How to use checksums |
e3c910b68de3c7241f78ea8875447faaecac8be717134c2e65926e13d4744eea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/0.0.0 CPython/3.7.6
|
Release files / pyqt_explanation_balloon-0.0.21-py3-none-any.whl
| Download URL | pyqt_explanation_balloon-0.0.21-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
105cf4a899bb42f8606c1ffb1ca26106e2e8f306f875a2dab7c40837430216d6
|
|
BLAKE2b-256 checksum How to use checksums |
6231228616cc1e0312fd115c136e06fac531b488a2507531572c3472a9c28baf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/0.0.0 CPython/3.7.6
|