[Python-Dev] Event loops, PyOS_InputHook, and Tkinter

skip@pobox.com skip at pobox.com
Sat Nov 12 06:15:03 CET 2005

    >> This sounds sort of like the situation that existed with sys.exitfunc
    >> before the creation of the atexit module.  Can't we develop an API
    >> similar to that so that many different event-loop-wanting packages
    >> can play nice together?

    Greg> I can't see how that would help. If the different hooks know
    Greg> nothing about each other, there's no way for one to know when to
    Greg> give up control to the next one in the chain.

If I have a Gtk app I have to feed other (socket, callback) pairs to it.  It
takes care of adding it to the select() call.  Python could dictate that the
way to play ball is for other packages (Tkinter, PyGtk, wxPython, etc) to
feed Python the (socket, callback) pair.  Then you have a uniform way to
control event-driven applications.  Today, a package like Michiel's has no
idea what sort of event loop it will encounter.  If Python provided the
event loop API it would be the same no matter what widget set happened to be

The sticking point is probably that a number of such packages presume they
will always provide the main event loop and have to way to feed their
sockets to another event loop controller.  That might present some hurdles
for the various package writers/Python wrappers.


More information about the Python-Dev mailing list