PyQt QLabel which can resize the font responsively accordance with window's size change
Project description
pyqt-responsive-label
PyQt QLabel which can resize the font responsively accordance with window's size change
Requirements
- PyQt5 >= 5.8
Setup
python -m pip install pyqt-responsive-label
Method Overview
setAcceptTextChange(f: bool)
- Choose the option that this should accept text change(paintEvent
) or not.
Example
from PyQt5.QtWidgets import QApplication, QVBoxLayout, QWidget
from pyqt_responsive_label import ResponsiveLabel
class Widget(QWidget):
def __init__(self):
super().__init__()
self.__initUi()
def __initUi(self):
responsiveLabel = ResponsiveLabel(self)
responsiveLabel.setText('ABC')
lay = QVBoxLayout()
lay.addWidget(responsiveLabel)
self.setMinimumSize(responsiveLabel.sizeHint())
self.setLayout(lay)
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
widget = Widget()
widget.show()
app.exec_()
Result
Like below, label font size is changing accordance with window's size.
Note: Since v0.0.3, text is smaller than result image above for avoiding excessive width problem.
See Also
- pyqt-timer-label - Application which is using the package.
Project details
Release history Release notifications | RSS feed
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-responsive-label-0.0.3.tar.gz
.
File metadata
- Download URL: pyqt-responsive-label-0.0.3.tar.gz
- Upload date:
- Size: 3.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 | 4d4f9fa6989437ad08ba64352163f88f8e3808caa05102c851f4386ed87615ca |
|
MD5 | 8a1bd4289b16108efd8783c0fb87dfab |
|
BLAKE2b-256 | 7a53a9422b7a02724dd340a0d06aad24df0ebeb7bad18452da6395320b41efcd |
File details
Details for the file pyqt_responsive_label-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: pyqt_responsive_label-0.0.3-py3-none-any.whl
- Upload date:
- Size: 3.9 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 | cc3079022e5ab7c207be6ae9c07c5d03a1e67d9e03ba4af88d7c0ad1e980833f |
|
MD5 | c9eec8c762e277edd5701b2a0a710b06 |
|
BLAKE2b-256 | 1d448d8c28e20d50ddb1a84215f2e8ee27e6c96d0132b1adf24d4a9c930a8332 |