fereria
2/28/2015 - 12:20 PM

scrollArea Test

scrollArea Test


import sys
from PySide           import QtCore, QtGui
from PySide.QtUiTools import QUiLoader

from scrollAreaTest import Ui_Form

class scrollArea(QtGui.QDialog):

    def __init__(self,parent=None):

        QtGui.QDialog.__init__(self,parent)

        self.ui = Ui_Form()
        self.ui.setupUi(self)
        self.scroll = self.ui.scrollArea.horizontalScrollBar()

        self.ui.LeftBtn.clicked.connect(self.moveLeft)
        self.ui.RightBtn.clicked.connect(self.moveRight)

        self.boxNum = 5

    def moveLeft(self):
        num = self.scroll.maximum()
        self.scroll.setValue(self.scroll.value() - int((num / self.boxNum)))

    def moveRight(self):
        num = self.scroll.maximum()
        self.scroll.setValue(self.scroll.value() + int(num / self.boxNum))

def main():

    app = QtGui.QApplication(sys.argv)
    win = scrollArea()
    win.show()
    sys.exit(app.exec_())



if __name__ == '__main__':

    main()