Skip to content

Instantly share code, notes, and snippets.

@fereria
Created February 28, 2015 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fereria/21d58f1b6d2358397e2a to your computer and use it in GitHub Desktop.
Save fereria/21d58f1b6d2358397e2a to your computer and use it in GitHub Desktop.
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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment