Nov-21-2022, 09:25 PM
I don't see any problem with your original code. I just added the main window and frame, and some code to change the progress bar when you type in the QEditText widget. I don't see any lahout changes.
from PySide6.QtWidgets import QApplication, QMainWindow, QFrame, QLineEdit, QProgressBar, QLabel, QGridLayout, QTextEdit from PySide6.QtCore import QTimer class Window(QMainWindow): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) frame = QFrame() self.setCentralWidget(frame) layout = QGridLayout(frame) header = ['To:', 'CC:', 'BCC:', 'Subject:'] edits = [QLineEdit(), QLineEdit(), QLineEdit(), QLineEdit()] for i, (lab, lin) in enumerate(zip(header, edits)): layout.addWidget(QLabel(lab), i, 0) layout.addWidget(lin, i, 1, 1, 5) self.edit = QTextEdit() self.prog = QProgressBar() layout.addWidget(self.edit, 4, 0, 1, 6) layout.addWidget(self.prog, 5, 1) timer = QTimer(self) timer.timeout.connect(self.update_progress) timer.start(100) def update_progress(self): self.prog.setValue(len(self.edit.toPlainText())) app = QApplication() window = Window() window.show() app.exec()