In my code, use one QLabel with fixed dimension/size. At beginning, I assign text "Hello,Python" to that QLablel. Now I want to change the text of the QLablel to "Hai, Welcome to Python".
How to decrease the font size of the QLabel, and display full text with that particular area/size (without any cut off / hidde /hidden) ?
import sys
from PyQt5.QtWidgets import *
class Labelexample(QWidget):
def __init__(self):
super().__init__()
self.labl = QLabel("Hello,Python",self)
self.tbox = QLineEdit(self)
self.labl.setFixedSize(150,30)
self.tbox.setFixedSize(200,30)
self.labl.move(50,50)
self.tbox.move(140,50)
self.labl.setText("Hai, welcome to Python")
# self.labl.adjustsize()
app = QApplication(sys.argv)
mywin = Labelexample()
mywin.show()
sys.exit(app.exec_())