The QPalette class can easily achieve the purpose of setting the window background image
def use_palette(self):
self.setWindowTitle("设置背景图片")
window_pale = QtGui.QPalette()
window_pale.setBrush(self.backgroundRole(), QtGui.QBrush(QtGui.QPixmap("F:\A_code\PyQT_Demo\\back_ground.png")))
self.setPalette(window_pale)