PyQt:给窗口设置背景图片(两种方法) | Set QMainWindow Background Image, Python QT
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() |
from:http://codeprogress.com/python/libraries/pyqt/showPyQTExample.php?index=424&key=QMainWindowBackground 继续>