ウィンドウの背景色をつける

2017/10/15

Python2.7.8, PySide1.2.2

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

import sys
from PyQt4 import QtGui

def main():

    app = QtGui.QApplication(sys.argv)

    w = QtGui.QWidget()
    p = w.palette()
    p.setColor(w.backgroundRole(), QtGui.QColor('#000'))
    w.setPalette(p)
    w.show()

    sys.exit(app.exec_())

if __name__ == '__main__':
    main()