Python 3的事件循环实现? [英] Event loop implementation for Python 3?
问题描述
ETA :我意识到这不是写一个事件循环系统非常困难。但是,我不想重新发明(我们现在仍然鼓励不要这样做,对吧? - ))
这是一个服务器应用程序,所以很明显我会想要一些没有绑定到GUI窗口小部件工具包或东西的东西。
如果答案是不,没有一个(可能;我确实是找不到一个),那么我很有可能为libev创建一个绑定Python 3。
我建议如下:
while True:
while queue:
queue.pop() )
然而,为了使其正常工作,您需要让事件系统将可调用事件置于队列中
(如果您对具体特定框架的绑定更感兴趣,例如GTK,Qt ,WxWidgets,NCurses,Cocoa,Winforms,然后再说!)。
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 as well.
ETA: I realize that it is not terribly difficult to write an event loop system. However, I don't want to reinvent the wheel (we are still encouraging not doing so these days, right? ;-))
This is planned for a server application, so obviously I'd want something that isn't tied to a GUI widget toolkit or something.
If the answer is "Nope, there isn't one" (probably; I sure as heck can't find one) then I will most likely create a binding for Python 3 for libev.
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!).
这篇关于Python 3的事件循环实现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!