It is necessary to place a button that will be located at the bottom right of the image (as in Paint, to stretch the image), so that you can use the scroll and the button is visible. It is not necessary that the button move enough so that the scroll does not overlap it.

import sys from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import * class Example(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): self.pixmap = QPixmap("hold.png") hbox = QHBoxLayout(self) lbl = QLabel('text', self) lbl.setPixmap(self.pixmap) lbl.setGeometry(0, 0, 280, 280) hbox.addWidget(lbl) self.setWindowTitle('Red Rock') class ScrollOnExample(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): self.widget = Example() scroll = QScrollArea() scroll.setBackgroundRole(QPalette.Dark) scroll.setWidget(self.widget) hbox = QHBoxLayout(self) hbox.addWidget(scroll) if __name__ == '__main__': app = QApplication(sys.argv) ex = ScrollOnExample() ex.show() sys.exit(app.exec_()) 
  • That button that you describe looks like QSizeGrip: doc.qt.io/Qt-5/qsizegrip.html - gil9red
  • # gil9red it should not change the size of the window, even if it does not move. It should be on the border of the image, while I could set its size and the scroll did not overlap it - Daniil
  • one
    What for? You can try to place the layout and that button on it, but I'm not sure that this will come out with QScrollArea. Alternatively, you can manually move the button, for this you will need it, or a successor from QScrollArea, for which the mouseMoveEvent will be blocked, or you will need an event-filter - gil9red

0