ウィンドウ色づけ

2014/12/14

Python2.7.6, pyQt4.11

# -*- coding: utf-8 -*-

import sys
from PyQt4 import QtGui

def main():

    app = QtGui.QApplication(sys.argv)
    w = QtGui.QMainWindow()
    palette = QtGui.QPalette()

    palette.setColor(QtGui.QPalette.Background,QtGui.QColor('#ff0000'))

    w.setPalette(palette)
    w.show()

    sys.exit(app.exec_())


if __name__ == '__main__':
    main()

  

QColor Class Reference
http://pyqt.sourceforge.net/Docs/PyQt4/qcolor.html

参考:

PyQT QMainWindow Background Color Example
http://codeprogress.com/python/libraries/pyqt/showPyQTExample.php?index=355&key=QMainWindowBgColor

How to set QWidget background color?
http://stackoverflow.com/questions/12655538/how-to-set-qwidget-background-color