1

enter image description here

As you know we can resize widgets in any software, there's an example in the image above.

Below is a simple code with two buttons. I want two resize widgets with mouse.

import sys
from PyQt6.QtWidgets import QWidget, QApplication, QHBoxLayout, QPushButton


app = QApplication(sys.argv)

class Window(QWidget):
    def __init__(self) -> None:
        super().__init__()

        #LayoutSet
        layout = QHBoxLayout()
        self.setLayout(layout)


        #Add buttons
        layout.addWidget(QPushButton("ok"))
        layout.addWidget(QPushButton("cancel"))





w = Window()
w.show()
sys.exit(app.exec())

I searched everywhere on the net but I couldn't find any answers.

Amin Khormaei
  • 379
  • 3
  • 8
  • 23
  • 1
    I don't see how the image would help us. Besides, resizing a button could be tricky, since the user may just click the button by mistake while they wanted to resize it; where should the resize action happen? Near the border? Around them? Maybe what you actually want is what [QSplitter](https://doc.qt.io/qt-6/qsplitter.html) provides. – musicamante Apr 03 '23 at 22:08
  • Let me check the QSplitter, and I'll inform you. Thank you for the reply – Amin Khormaei Apr 03 '23 at 22:56
  • QSplitter is exactly what I wanted, Thank you. – Amin Khormaei Apr 03 '23 at 23:09
  • 1
    See https://stackoverflow.com/q/37886313 and https://stackoverflow.com/q/60486612 – musicamante Apr 04 '23 at 04:40

0 Answers0