myapp/myapp.py
def main():
    signal.signal(signal.SIGINT, sigint_handler)

    """
    This attribute need to be set before QCoreApplication created,
    it will still show warning because QWebEngineView::initialize
    call this at the end.
    """
    MyApp.setAttribute(Qt.AA_ShareOpenGLContexts, True)
    app = MyApp(sys.argv[1:])

    # Python cannot handle signals while the Qt event loop is running.
    # so we need to use QTimer to let the interpreter run from time to time.
    # https://stackoverflow.com/questions/4938723/what-is-the-correct-way-to-make-my-pyqt-application-quit-when-killed-from-the-co
    timer = QTimer()
    timer.start(500)  # You may change this if you wish.
    timer.timeout.connect(lambda: None)  # Let the interpreter run each 500 ms.
    sys.exit(app.exec_())

    This attribute need to be set before QCoreApplication created,
    it will still show warning because QWebEngineView::initialize
    call this at the end.
    
This attribute need to be set before QCoreApplication created,
it will still show warning because QWebEngineView::initialize
call this at the end.
This attribute need to be set before QCoreApplication created it will still show warning because QWebEngineView :: initialize call this at the end .
def main():
    signal.signal(signal.SIGINT, sigint_handler)
    MyApp.setAttribute(Qt.AA_ShareOpenGLContexts, True)
    app = MyApp(sys.argv[1:])
    timer = QTimer()
    timer.start(500)  
    timer.timeout.connect(lambda: None)  
    sys.exit(app.exec_())
def main ( ) : signal . signal ( signal . SIGINT , sigint_handler ) MyApp . setAttribute ( Qt . AA_ShareOpenGLContexts , True ) app = MyApp ( sys . argv [ 1 : ] ) timer = QTimer ( ) timer . start ( 500 ) timer . timeout . connect ( lambda : None ) sys . exit ( app . exec_ ( ) )
This attribute need to be set before QCoreApplication created,
it will still show warning because QWebEngineView::initialize
call this at the end.
This attribute need to be set before QCoreApplication created it will still show warning because QWebEngineView :: initialize call this at the end .
"""
    This attribute need to be set before QCoreApplication created,
    it will still show warning because QWebEngineView::initialize
    call this at the end.
    """ # Python cannot handle signals while the Qt event loop is running. # so we need to use QTimer to let the interpreter run from time to time. # https://stackoverflow.com/questions/4938723/what-is-the-correct-way-to-make-my-pyqt-application-quit-when-killed-from-the-co # You may change this if you wish. # Let the interpreter run each 500 ms.