Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 为什么图形效果没有';PyQt5中的t变化?_Python 3.x_Qt5_Pyqt5 - Fatal编程技术网

Python 3.x 为什么图形效果没有';PyQt5中的t变化?

Python 3.x 为什么图形效果没有';PyQt5中的t变化?,python-3.x,qt5,pyqt5,Python 3.x,Qt5,Pyqt5,我正在使用PyQt5和Python3编写一个程序。 我正在使用QGraphicsBlerEffect在显示弹出窗口时在主窗口小部件上产生模糊效果。 问题是,当弹出窗口关闭时,模糊效果仍在主窗口小部件上,并且不会正常显示。如何在关闭弹出窗口后将其设置为正常?(我在关闭弹出窗口时将mainwindow的graphicsEffect设置为None,但它不会改变任何内容) 代码如下: 主窗口小部件: self.blureffect = QGraphicsBlurEffect(self) #def

我正在使用PyQt5和Python3编写一个程序。 我正在使用QGraphicsBlerEffect在显示弹出窗口时在主窗口小部件上产生模糊效果。 问题是,当弹出窗口关闭时,模糊效果仍在主窗口小部件上,并且不会正常显示。如何在关闭弹出窗口后将其设置为正常?(我在关闭弹出窗口时将mainwindow的graphicsEffect设置为None,但它不会改变任何内容)

代码如下:

主窗口小部件:

    self.blureffect = QGraphicsBlurEffect(self) #defining the effect

    def fontpgshow(self): #shows the popup window
        self.setGraphicsEffect(self.blureffect) #puts the blur effect on the main widget

        #the 3 bottom lines show the popup window
        import fontwindow
        self.fontpg = fontwindow.fontpage()
        self.fontpg.show()
弹出窗口:

    def closeEvent(self,event):
        event.accept()
        #in the bottom lines I set the effect of main window to None
        import settingswindow
        self.setpg = settingswindow.settingspage()
        self.setpg.setGraphicsEffect(None)

我通过将弹出窗口的类型从
QWidget
更改为
QDialog
解决了我的问题,并在
QDialog
中使用了
self.accept()
self.reject()
将信号发送回主窗口小部件,说明这里是设置页面。收到信号后,我将主窗口小部件的图形效果设置为
None
,现在一切正常。

提供@eyllaesc有很多代码,我无法将它们全部放在这里。你可以看到我这样的问题:“在PyQt中使用QGraphicsBlerEffect的正确方法是什么?你确定
self.setpg
指的是正确的
QWidget
——什么是
self.setpg.graphicsEffect()
return?否则,显示的代码没有明显错误。@G.M.是的,它指的是“设置页面”,这是一个QWidget,它在软件中的作用类似于我的设置页面。在设置图形效果之前,它不返回任何内容,之后它返回“”。