Michiel de Hoon пишет:
> --- On Wed, 6/30/10, Ilya Murav'jov <[email protected]> wrote:
>> By the way, I don't see a reason for adding event loop
>> support to Python,- which one (gtk, qt, GetMessage, ...)?
>> They are very different and ... the strongest will win :)
> 
> In essence, they're all pretty much the same. Somewhere buried in the 
> gtk/qt/wx/fltk/tcltk event loop is a call to select() (or 
> MsgWaitForMultipleObjects() on Windows). The purpose of the main event loop 
> support in gtk/qt/wx/fltk/tcltk is to keep track of which file descriptors to 
> select() for, which timed functions to call, which functions to call before 
> the call to select(), which functions to call after the call to select(), etc.
> 
> Now, gtk/qt/wx/fltk/tcltk each maintain their own registry of stuff to do in 
> the event loop. For example, a list of file descriptors to select() for. So 
> if the gtk event loop calls select(), it won't know about the file 
> descriptors that for example qt wants to select() for.
> 
> If there were a way for gtk/qt/wx/fltk/tcltk to tell Python which file 
> descriptors to select() for, and Python itself makes the call to select(), 
> then all file descriptors get served appropriately. Same thing for everything 
> else that needs to be done in the event loop.
> 
> --Michiel.

1. In ideal world, that would be done, but we live in real world:
- who need it? As for me, I don't need
- how many people/program use 2 toolkits altogether?

2. (for gtk) To be more concrete, you can get descriptors you want,-
just see the function g_main_context_iterate(),- you need just to
replace the function g_main_context_poll() there, nothing else. And you
need not only descriptors, but timeout too. So, one may see the other
toolkits too and wrap multiple loops in one (no magic, just code), here
is "the plan":
 - first, get the fds and timeout from each toolkit (every call, cause
fds may change!)
 - resolve what toolkit have event by resulting fd (or timeout)
 - complete the work invoking toolkit's dispatching function
 - loop again.

Regards,
 Ilya Murav'jov
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to