def add_shadow(self, button):
# 添加阴影
self.effect_shadow = QGraphicsDropShadowEffect(self)
self.effect_shadow.setOffset(5, 5) # 偏移
self.effect_shadow.setBlurRadius(5) # 阴影半径
self.effect_shadow.setColor(QColor('#000000')) # 阴影颜色
button.setGraphicsEffect(self.effect_shadow) # 将设置套用到button窗口中
def del_shadow(self,button):#删除阴影
self.effect_shadow = QGraphicsDropShadowEffect(self)
self.effect_shadow.setOffset(0, 0) # 偏移
self.effect_shadow.setBlurRadius(0) # 阴影半径
self.effect_shadow.setColor(QtCore.Qt.blue) # 阴影颜色
button.setGraphicsEffect(self.effect_shadow) # 将设置套用到button窗口中
网友评论