direct.showbase.EventGroup
from direct.showbase.EventGroup import EventGroup
This module defines the EventGroup class.
Inheritance diagram
- class EventGroup(name, subEvents=None, doneEvent=None)[source]
Bases:
DirectObject
This class allows you to group together multiple events and treat them as a single event. The EventGroup will not send out its event until all of its sub-events have occured.
- __init__(self, name, subEvents=None, doneEvent=None)[source]
Provide a meaningful name to aid debugging.
doneEvent is optional. If not provided, a unique done event will be generated and is available as EventGroup.getDoneEvent().
Examples:
# waits for gotRed and gotBlue, then sends out ‘gotColors’ EventGroup(‘getRedAndBlue’, (‘gotRed’, ‘gotBlue’), doneEvent=’gotColors’)
# waits for two interests to close, then calls self._handleBothInterestsClosed() # uses EventGroup.getDoneEvent() and EventGroup.newEvent() to generate unique, # disposable event names eGroup = EventGroup(‘closeInterests’) self.acceptOnce(eGroup.getDoneEvent(), self._handleBothInterestsClosed) base.cr.closeInterest(interest1, event=eGroup.newEvent(‘closeInterest1’)) base.cr.closeInterest(interest2, event=eGroup.newEvent(‘closeInterest2’))