Python PyQt5:我的应用程序处于焦点状态时的事件

Python PyQt5:我的应用程序处于焦点状态时的事件,python,python-3.x,pyqt5,Python,Python 3.x,Pyqt5,我想在应用程序聚焦时执行“onFocus”功能,因为当我使用ALT+TAB从应用程序导航时,它会显示窗口,代码: def onFocus(w): w.showMinimized() # another stuff if __name__ == '__main__': app = QtWidgets.QApplication([]) w = QtWidgets.QWidget() onFocus(w) exit(app.exec_()) 这项活动

我想在应用程序聚焦时执行“onFocus”功能,因为当我使用ALT+TAB从应用程序导航时,它会显示窗口,代码:

def onFocus(w):
    w.showMinimized()
    # another stuff

if __name__ == '__main__':
    app = QtWidgets.QApplication([])
    w = QtWidgets.QWidget()
    onFocus(w)
    exit(app.exec_())
这项活动的目的是什么?非常感谢

此处已解决:此处已解决: