[EMAIL PROTECTED] wrote:

>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
>used.
>  
>
This is essentially how Tcl does it (and which, btw, is currently being 
used in Tkinter):
Tcl has the functions *Tcl_CreateFileHandler/**Tcl_DeleteFileHandler*, 
which allow a user to add a file descriptor to the list of file 
descriptors to select() on, and to specify a callback function to the 
function to be called when the file descriptor is signaled. A similar 
API in Python would give users a clean way to hook into the event loop, 
independent of which other packages are hooked into the event loop.
//

>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.
>  
>
This may not be such a serious problem. Being able to hook into Python's 
event loop is important only if users want to be able to use the 
extension module in interactive mode. For an extension module such as 
PyGtk, the developers may decide that PyGtk is likely to be run in 
non-interactive mode only, for which the PyGtk mainloop is sufficient. 
Having an event loop API in Python won't hurt them.

--Michiel.

-- 
Michiel de Hoon
Center for Computational Biology and Bioinformatics
Columbia University
1150 St Nicholas Avenue
New York, NY 10032


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to