![]() Clock () got_keypress = False while not got_keypress and timer. ![]() globals ()( 'keyboard' ) # Check for keypresses until maxWait is exceeded # NB pygame.event does have a wait() function that will # do this and maybe leave more cpu idle time? timer = psychopy. We can work around this conflict by # accessing the global scope explicitly. # We need to invoke clearEvents(), but our keyword argument is # also called clearEvents. """ if clearEvents : # Only consider keypresses from here onwards. clearEvents : **True** or False Whether to clear the keyboard event buffer (and discard preceding keypresses) before starting to monitor for new keypresses. If a `core.Clock` is given then the time will be relative to the `Clock`'s last reset. timeStamped : **False**, True, or `Clock` If True will return a list of tuples instead of a list of keynames. The modifiers are a dict of keyboard modifier flags keyed by the modifier name (eg. NB, pygame doesn't return timestamps (they are always 0) modifiers : **False** or True If True will return a list of tuples instead of a list of keynames. If the keyList is `None`, all keys will be checked and the key buffer will be cleared completely. Only keypresses from this set of keys will be removed from the keyboard buffer. keyList : **None** or Allows the user to specify a set of keys to check for. Default is float('inf') which simply waits forever. Maximum number of seconds period and which keys to wait for. ![]() :Parameters: maxWait : any numeric value. def waitKeys ( maxWait = float ( 'inf' ), keyList = None, modifiers = False, timeStamped = False, clearEvents = True ): """Same as `~`, but halts everything (including drawing) while awaiting input from keyboard. format ( timeStamped, windowSystem, modifiers )) #!/usr/bin/env python # -*- coding: utf-8 -*- """To handle input from keyboard, mouse and joystick (joysticks require pygame to be installed).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |