Created
February 28, 2015 12:20
-
-
Save fereria/21d58f1b6d2358397e2a to your computer and use it in GitHub Desktop.
scrollArea Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment