Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yjg30737/pyqt-responsive-label
PyQt QLabel which can resize the font responsively accordance with window's size change
https://github.com/yjg30737/pyqt-responsive-label
pyqt-examples pyqt-gui pyqt-tutorial pyqt5 pyqt5-examples pyqt5-gui python python3 python37 qlabel qresizeevent qt qt-tutorial qt5
Last synced: about 1 month ago
JSON representation
PyQt QLabel which can resize the font responsively accordance with window's size change
- Host: GitHub
- URL: https://github.com/yjg30737/pyqt-responsive-label
- Owner: yjg30737
- License: mit
- Created: 2022-04-19T03:37:28.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-06T03:11:17.000Z (over 2 years ago)
- Last Synced: 2024-05-29T12:33:30.267Z (9 months ago)
- Topics: pyqt-examples, pyqt-gui, pyqt-tutorial, pyqt5, pyqt5-examples, pyqt5-gui, python, python3, python37, qlabel, qresizeevent, qt, qt-tutorial, qt5
- Language: Python
- Homepage:
- Size: 22.5 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
```python
from PyQt5.QtWidgets import QApplication, QVBoxLayout, QWidget
from pyqt_responsive_label import ResponsiveLabelclass 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 sysapp = QApplication(sys.argv)
widget = Widget()
widget.show()
app.exec_()
```Result
Like below, label font size is changing accordance with window's size.
![image](https://user-images.githubusercontent.com/55078043/163919017-31d6ae6b-329a-414e-ad37-a09dee778faf.png)
![image](https://user-images.githubusercontent.com/55078043/163919028-c718a549-71bf-4581-8f28-19c6a36719fc.png)
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.