Event loop implementation for Python 3?

前端 未结 2 796
耶瑟儿~
耶瑟儿~ 2021-01-07 00:45

Does anyone know of an event loop library (or bindings) available for Python 3? It\'s okay if it only does UNIX systems, though I would prefer something that does Windows a

相关标签:
2条回答
  • 2021-01-07 01:22

    I suggest something like:

    while True:
        while queue:
            queue.pop()()
    

    For that to work, however, you need to have the event system put callable events onto the queue.

    (If you are more interested in a specific binding to a specific framework, such as GTK, Qt, WxWidgets, NCurses, Cocoa, Winforms, whatever, then say that!).

    0 讨论(0)
  • 2021-01-07 01:37

    libev is available for python as pyev module: http://code.google.com/p/pyev/

    0 讨论(0)
提交回复
热议问题