Esempio n. 1
0
def eventIterator():
    while True:
        yield eventmodule.wait()
        while True:
            event = eventmodule.poll()
            if event.type == NOEVENT:
                break
            else:
                yield event
def eventIterator():
    while True:
        yield eventmodule.wait()
        while True:
            event = eventmodule.poll()
            if event.type == NOEVENT:
                break
            else:
                yield event
Esempio n. 3
0
def wait_for_event():
    # Repeat until a relevant event happened
    while True:
        # Discard all input that happened before entering the loop
        EventModule.get()

        # Wait for event
        event = EventModule.wait()

        # Return Event-Object
        r, e = convert_event(event)
        if r:
            return e
 def test_wait(self):
 
     # __doc__ (as of 2008-08-02) for pygame.fastevent.wait:
 
       # pygame.fastevent.wait() -> Event
       # wait for an event
       # 
       # Returns the current event on the queue. If there are no messages
       # waiting on the queue, this will not return until one is
       # available. Sometimes it is important to use this wait to get
       # events from the queue, it will allow your application to idle
       # when the user isn't doing anything with it.
     
     event.post(pygame.event.Event(1))
     self.assertEquals(fastevent.wait().type, 1, race_condition_notification)
Esempio n. 5
0
    def test_wait(self):

        # __doc__ (as of 2008-08-02) for pygame.fastevent.wait:

        # pygame.fastevent.wait() -> Event
        # wait for an event
        #
        # Returns the current event on the queue. If there are no messages
        # waiting on the queue, this will not return until one is
        # available. Sometimes it is important to use this wait to get
        # events from the queue, it will allow your application to idle
        # when the user isn't doing anything with it.

        event.post(pygame.event.Event(1))
        self.assertEqual(fastevent.wait().type, 1, race_condition_notification)
Esempio n. 6
0
 def eventIterator(self):
     while True:
         # print "***"
         # ---
         # self._tickClock() # 20100908 got rid of this, move to looping call
         #20070820 if not self._paused:
         #20070820    self.updateObjects() # move
         # ---
         if UsingFastEvent:
             #print "Yielding"
             yield eventmodule.wait()  # seems to hang otherwise
             #print "Done Yielding"
         while True:
             event = eventmodule.poll()
             if event.type == NOEVENT:
                 break
             else:
                 yield event
         # ---
         # print "***---"
         """ # 20100908 trying looping call instead of doing it here
Esempio n. 7
0
 def eventIterator(self):
     while True:
         # print "***"
         # ---
         # self._tickClock() # 20100908 got rid of this, move to looping call
         #20070820 if not self._paused:
         #20070820    self.updateObjects() # move
         # ---
         if UsingFastEvent:
             #print "Yielding"
             yield eventmodule.wait() # seems to hang otherwise
             #print "Done Yielding"
         while True:
             event = eventmodule.poll()
             if event.type == NOEVENT:
                 break
             else:
                 yield event
         # ---
         # print "***---"
         """ # 20100908 trying looping call instead of doing it here