import sys
import traceback
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *

StyleSheet = """
QWidget{
     background:qlineargradient(spread:pad,x1:1,y1:0,x2:0,y2:1,stop:0 rgb(51,146,255),stop:1 rgb(255,255,255));  
}

"""


class Main(QWidget):

    def __init__(self, parent=None):
        super(Main, self).__init__(parent)
        self.setWindowTitle("渐变背景demo")
        self.setStyleSheet(StyleSheet)

if __name__ == "__main__":
    app = QApplication(sys.argv)
    main = Main()
    main.show()
    sys.exit(app.exec_())