pyqt-toast
PyQt Toast (Small message displayed on the screen, visible for a short time)
Requirements
PyQt5 >= 5.8
Setup
python -m pip install pyqt-toast
Included Packages
Usage
Toast(text='This is toast', duration=3, parent=self)- Constructor. Givingparentargument toselfvalue helps toast to maintain its place after window got moved.
Note: You have to declare this one time as a class variable at initializing point(e.g. __initUi) or else new one will pop up even though last one is still showing.
-
setPosition(pos: QPoint)- Place center of the toast at the given position. -
setFont(font: QFont)- Set the font of text in toast. Toast's size will be automatically changed based on text's size. -
setForegroundColor(color)- Set the text(foreground) color.colorargument can be bothstr(6-digits hex color string),QColortypes. -
setBackgroundColor(color)- Set the background color.colorargument can be bothstr(6-digits hex color string),QColortypes. -
setOpacity(opacity: float)- Set the opacity of toast. -
setDuration(duration: int)- Set the duration of toast. -
setAlignment(alignment)- Set the alignment of text.
Example
Code Sample
from PyQt5.QtWidgets import QWidget, QApplication, QPushButton, QGridLayout
from pyqt_toast import Toast
class ToastExample(QWidget):
def __init__(self):
super().__init__()
self.__initUi()
def __initUi(self):
btn = QPushButton('Krabby Patty secret formula')
self.__toast = Toast(text='The Krabby Patty formula is the sole property of the Krusty Krab and is only to be discussed in part or in whole with its creator Mr. Krabs. Duplication of this formula is punishable by law. Restrictions apply, results may vary.', duration=3, parent=self)
btn.clicked.connect(self.__toast.show)
lay = QGridLayout()
lay.addWidget(btn)
self.setLayout(lay)
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
toastExample = ToastExample()
toastExample.show()
app.exec_()
Result
Release files for pyqt-toast 0.0.15
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-toast-0.0.15.tar.gz | 4.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyqt_toast-0.0.15-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.9 kB
Release files / pyqt-toast-0.0.15.tar.gz
| Download URL | pyqt-toast-0.0.15.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d9464420f1c550ed7340c866b57093cb2521ea1493077ac1db705a63fedc9600
|
|
BLAKE2b-256 checksum How to use checksums |
7a08b1c2cd73bd7607b408e83bf28ed87a3b85b27477110183a3003b1627311f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/0.0.0 CPython/3.7.6
|
Release files / pyqt_toast-0.0.15-py3-none-any.whl
| Download URL | pyqt_toast-0.0.15-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
01f7fcff1acb3924d11cafa18e870248580e3748c8e2f6abf523adb95c266962
|
|
BLAKE2b-256 checksum How to use checksums |
cb14170c8918d915becf3212a67f467b7d57ac8fc2a72bbcfb665a098ff5d6f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/0.0.0 CPython/3.7.6
|