How can I add content to a scroll area in pyqt4? DO i custom define a widget? For example,
if i had a array or a lista =[10,2,2,2,22,3,3,3]
. How should I displ
If you want to add content to a scroll area, you need to define a new widget and add that to the scroll area - like you would add a widget to a frame. For example:
textEdit = QtGui.QTextEdit()
scrollArea = QtGui.QScrollArea(MainWindow)
scrollArea.setWidget(textEdit)
Then, you can use textEdit.append() or textEdit.setText() to add the data in the array to the text box in the scroll area. The documentation says it all, really, albeit in C rather than python, but its obvious what you need to do:
QLabel *imageLabel = new QLabel;
QImage image("happyguy.png");
imageLabel->setPixmap(QPixmap.fromImage(image));
scrollArea = new QScrollArea;
scrollArea->setBackgroundRole(QPalette.Dark);
scrollArea->setWidget(imageLabel);