Форум сайта python.su
import sys from PyQt4 import QtGui class Example(QtGui.QWidget): def __init__(self): super(Example, self).__init__() self.initUI() def initUI(self): lab1 = QtGui.QLabel('label1', self) lab1.move(15, 10) lab2 = QtGui.QLabel('label2', self) lab2.move(35, 110) lab3 = QtGui.QLabel('label3', self) lab3.move(55, 210) self.show() self.setGeometry(300, 300, 250, 150) def main(): app = QtGui.QApplication(sys.argv) ex = Example() sys.exit(app.exec_()) if __name__ == '__main__': main()
Офлайн
import sys from PyQt4 import QtGui, QtCore class Example(QtGui.QWidget): def __init__(self, parent): super(Example, self).__init__(parent) self.initUI() def initUI(self): lab1 = QtGui.QLabel('label1', self) lab1.move(15, 10) lab2 = QtGui.QLabel('label2', self) lab2.move(35, 110) lab3 = QtGui.QLabel('label3', self) lab3.move(55, 210) self.show() self.setFixedSize(220, 250) class Window(QtGui.QScrollArea): def __init__(self): super(Window, self).__init__() self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn) self.setGeometry(300, 300, 250, 150) self.ex = Example(self) self.setWidget(self.ex) def main(): app = QtGui.QApplication(sys.argv) w = Window() w.show() sys.exit(app.exec_()) if __name__ == '__main__': main()
Офлайн
agalen спасибочки
Офлайн