INNER CODE UNIT · Python

qtapp

toolsforexperiments/plottr · plottr/__init__.py:61

def qtapp() -> QtWidgets.QApplication:
    """make a QT application that can be interrupted by Ctrl+C in the terminal."""
    signal.signal(signal.SIGINT, signal.SIG_DFL)
    app = QtWidgets.QApplication(sys.argv)
    return app


_garbageCollector: Optional[GarbageCollector] = None


def enableEventLoopGarbageCollection(app: QtCore.QCoreApplication,
                                     interval_sec: float = 1.0) -> None:
    """Run Python's cyclic garbage collector only from the Qt event loop.

    Flowcharts, nodes and their pyqtgraph/Qt objects form reference cycles,
    so once discarded (e.g., a closed plot window) they are only freed by
    Python's cyclic garbage collector. By default that collector runs
    whenever an allocation happens to cross its threshold -- including

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…