views:

50

answers:

1

You can know if the event stack is empty calling the gtk.events_pending() method, but I want to manipulate the pending events and filter it before the next gtk loop cycle, this data must be stored somewhere, but where?

Thanks.

+1  A: 

You can control the event loop yourself. Rather than calling gtk.main(), you can use gtk.main_iteration.

Your loop could then be:

while running:
    #filter events here
    gtk.main_iteration(true)

see here for more info.

SB
Without calling gtk.main() pygtk exits execution, does not wait for events, so should I open an endless while?
mkotechno
Works, a dirty solution but better than nothing. Thanks
mkotechno
I wouldn't necessarily call this a dirty solution. gtk.main internally just calls these methods. You replace gtk.main with your own loop.
SB
I call it dirty solution because now I need to change a lot of nested GUI loops resulting of a lack of the obvious method gtk.get_event_stack() ... BTW in the endless loop gtk.get_current_event() is returning nothing, how should I filter them? Thanks for your time again.
mkotechno
Ah you probably can't quite filter them the way you want after I read the API docs again. What kind of filtering do you want to do? What kind of events are you hoping to filter
SB
Thanks SB, I finally found and alternative solution by doing one-to-one event comparisions in the callbacks. GTK loops wins me. See you.
mkotechno