如何在没有 GUI 的情况下使用 PyQt?
How use PyQt without GUI?
我想使用 PyQt4
创建 python 服务器应用程序而不使用 GUI(signal/slots、线程、进程和其他核心模式)。
我该如何创建它?
如果您需要没有 GUI 的 Qt EventLoop,您可以使用 QCoreApplication
而不是 QApplication
:http://pyqt.sourceforge.net/Docs/PyQt4/qcoreapplication.html
来自docs:
The QCoreApplication class provides an event loop for console Qt
applications.
This class is used by non-GUI applications to provide their event
loop. For non-GUI application that uses Qt, there should be exactly
one QCoreApplication object. For GUI applications, see QApplication.
QCoreApplication contains the main event loop, where all events from
the operating system (e.g., timer and network events) and other
sources are processed and dispatched. It also handles the
application's initialization and finalization, as well as system-wide
and application-wide settings.
我想使用 PyQt4
创建 python 服务器应用程序而不使用 GUI(signal/slots、线程、进程和其他核心模式)。
我该如何创建它?
如果您需要没有 GUI 的 Qt EventLoop,您可以使用 QCoreApplication
而不是 QApplication
:http://pyqt.sourceforge.net/Docs/PyQt4/qcoreapplication.html
来自docs:
The QCoreApplication class provides an event loop for console Qt applications.
This class is used by non-GUI applications to provide their event loop. For non-GUI application that uses Qt, there should be exactly one QCoreApplication object. For GUI applications, see QApplication.
QCoreApplication contains the main event loop, where all events from the operating system (e.g., timer and network events) and other sources are processed and dispatched. It also handles the application's initialization and finalization, as well as system-wide and application-wide settings.