[PyQt] QScrollArea test
Christopher Spears
cspears2002 at yahoo.com
Mon Jan 25 00:27:49 GMT 2010
I'm trying to add scrollbars to a GUI, so I've been learning about the QScrollArea class. After reading the online docs and several postings, I wrote a little script for a test:
#!/usr/bin/env python
import sys
from PyQt4 import QtCore, QtGui
class test(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.setWindowTitle('Test')
self.label = QtGui.QLabel('Label Blah Blah')
self.scrollArea = QtGui.QScrollArea()
self.scrollArea.setWidget(self.label)
hLayout = QtGui.QHBoxLayout()
hLayout.addWidget(self.scrollArea)
self.setLayout(hLayout)
app = QtGui.QApplication(sys.argv)
t = test()
t.show()
sys.exit(app.exec_())
The problem with this script is that the scroll area that is generated does not have any scrollbars. I played with adjusting the image's size and saw no changes. Not sure what I am doing wrong...
More information about the PyQt
mailing list