PyQt-Frameless-Window
PyQt-Frameless-Window copied to clipboard
修改背景为暗色后,窗口从隐藏状态切换为显示状态会出现白色闪屏现象
Describe the bug
A clear and concise description of what the bug is.
问题的简要描述。
当我修改窗口背景为暗色后,然后将窗口从隐藏状态切换为显示状态时,窗口会先短暂的显示白色,然后才会显示为我设置的背景色
Environment 环境信息
- OS: Windows11
- DPI scaling: 125%
- Python: 3.9 64-bit
- PyQt5: 5.15.2
To Reproduce
复现问题的步骤,推荐使用 gif 进行演示。
Steps to reproduce the behavior(you can use GIF to demonstrate :):
如图所示:
- 点击隐藏
- 然后点击显示
- 可以看到窗口会先短暂的显示白色,然后才会显示为我设置的背景色
Code 最小复现代码
# class Window(FramelessWindow):
def __init__(self, parent=None):
super().__init__(parent=parent)
# change the default title bar if you like
self.setTitleBar(CustomTitleBar(self))
# self.label = QLabel(self)
# self.label.setScaledContents(True)
# self.label.setPixmap(QPixmap("screenshot/shoko.png"))
# self.setWindowIcon(QIcon("screenshot/logo.png"))
self.setWindowIcon(QIcon("image/logo128.ico"))
self.setWindowTitle("Bridge")
self.setStyleSheet("background:rgb(39,40,34)")
main函数:
w1 = Window()
w2 = QWidget()
w2.resize(100,100)
b1=QPushButton("w1隐藏",w2)
b2=QPushButton("w1显示",w2)
b1.clicked.connect(w1.hide)
b2.clicked.connect(w1.show)
b2.move(0,30)
w2.show()
w1.show()
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
应该是系统问题,最大最小化都会有类似的情况,这个没得修,你win10 调成暗色模式 然后类似操作也会闪白底, 看了下调用,是用的windows的dll来实现的,如果系统dll有问题那么这个插件也没法解决。