1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | from PyQt4.QtGui import * import sys def main(): app = QApplication(sys.argv) window = QMainWindow() palette = QPalette() palette.setBrush(QPalette.Background,QBrush(QPixmap("grass.jpg"))) window.setPalette(palette) window.setWindowTitle("QMainWindow Background Image") window.show() return app.exec_() if __name__ == '__main__': main() |
1 | self.results.setStyleSheet("background-image: url(" + fname + "); background-repeat: no-repeat; background-position: center;") |