禁用 PyQt5 window 影子
Disabling PyQt5 window shadow
我的 PyQt5 window 上有一种非常烦人的 shadow/frame。 window 是自定义 class:
class CustomWindow(QMainWindow):
def __init__(self):
super(CustomWindow,self).__init__()
self.bg = '#FFFFFF'
self.opacity =1
def paintEvent(self, event=None):
painter = QPainter(self)
painter.setOpacity(self.opacity)
painter.setBrush(QColor(self.bg))
painter.setPen(QPen(QColor(0,0,0)))
painter.drawRect(self.rect())
def config(self, bg, op):
self.bg = bg
self.opacity = op
我说的影子东西:
可以看到window的左边和上边有细黑线。有谁知道如何禁用它们?
Musicmante 的解决方案有效:
You're drawing it. 0, 0, 0 is black in rgb. Change to painter.setPen(Qt.NoPen)
我的 PyQt5 window 上有一种非常烦人的 shadow/frame。 window 是自定义 class:
class CustomWindow(QMainWindow):
def __init__(self):
super(CustomWindow,self).__init__()
self.bg = '#FFFFFF'
self.opacity =1
def paintEvent(self, event=None):
painter = QPainter(self)
painter.setOpacity(self.opacity)
painter.setBrush(QColor(self.bg))
painter.setPen(QPen(QColor(0,0,0)))
painter.drawRect(self.rect())
def config(self, bg, op):
self.bg = bg
self.opacity = op
我说的影子东西:
可以看到window的左边和上边有细黑线。有谁知道如何禁用它们?
Musicmante 的解决方案有效:
You're drawing it. 0, 0, 0 is black in rgb. Change to painter.setPen(Qt.NoPen)