モジュールの関数 ================== clearEvents(eventType=None) ---------------------------------------- 現在イベントバッファにあるイベントを消去する。 引数で'mouse', 'joystick', 'keyboard'のいずれかを指定することによって、該当する種類のイベントのみ消去することができる。Noneを指定した場合、すべての種類のイベントが消去される。デフォルト値はNoneである。 デフォルトではすべてのイベントが消去される。 .. Clears all events currently in the event buffer. .. Optional argument, eventType, specifies only certain types to be cleared. .. Parameters: .. eventType .. : None, ‘mouse’, ‘joystick’, ‘keyboard’ .. If this is not None then only events of the given type are cleared waitKeys(maxWait=inf, keyList=None, modifiers=False, timeStamped=False) -------------------------------------------------------------------------------- getKeysと同様にキーボードのキー押しイベントを取得するメソッドだが、(描画も含めて)すべての処理を停止してキーボードからの入力を待ち続ける。 内部でキーボードイベントが消去されるため、未取得のキー押しイベントはすべて失われる。 .. Same as ~psychopy.event.getKeys, but halts everything (including drawing) while awaiting input from keyboard. Implicitly clears keyboard, so any preceding keypresses will be lost. =============== =================================================================================================== パラメータ 解説 =============== =================================================================================================== maxWait 待ち時間の上限を秒で指定する。デフォルト値はinf、すなわち無限に待ち続ける。 modifiers TrueまたはFalse。Trueであればキー名のリストではなくタプルのリストが返される。それぞれのタプルには (keyname, modifiers)のように、第1要素にキー名、第2要素に修飾キーの状態を示す辞書オブジェクトが 含まれている。辞書オブジェクトからは'shift'、'ctrl'などの修飾キー名をキーとして各キーの状態を取得 することが出来る。 =============== =================================================================================================== タイムアウトした場合はNoneが返される。 .. Parameters: .. maxWait .. : any numeric value. .. Maximum number of seconds period and which keys to wait for. Default is float(‘inf’) which simply waits forever. .. modifiers .. : False or True .. If True will return a list of tuples instead of a list of keynames. Each tuple has (keyname, modifiers). The modifiers are a dict of keyboard modifier flags keyed by the modifier name (eg. ‘shift’, ‘ctrl’). .. Returns None if times out. getKeys(keyList=None, modifiers=False, timeStamped=False) ---------------------------------------------------------------- キーボードの押されたキー名のリストを返す。 =============== =================================================================================================== パラメータ 解説 =============== =================================================================================================== keyList キー押しイベントを確認するキーを制限する。確認するキー名を並べたシーケンスで指定する。シーケンスに 含まれていないキーのキー押しイベントは削除されない(訳注:したがって、スペースキーとリターンキーの イベントがキューに含まれている時にkeyList=['space']でgetKey()を実行するとスペースキーのイベントだけ が消去されてリターンキーのイベントは残る。続いてkeyList=['return']でgetKey()を実行するとリターン キーのイベントを取得できる)。 Noneの場合はすべてのキーのキー押しイベントが返され、イベントキューは完全に空になる。 modifiers TrueまたはFalse。Trueであればキー名のリストではなくタプルのリストが返される。それぞれのタプルには (keyname, modifiers)のように、第1要素にキー名、第2要素に修飾キーの状態を示す辞書オブジェクトが 含まれている。辞書オブジェクトからは'shift'、'ctrl'などの修飾キー名をキーとして各キーの状態を取得 することが出来る。 timeStamped True, Falseまたはpsychopy.core.Clockオブジェクト。Trueであればタプルのリストが返される。それぞれの タプルは(keyname, time)の形式で、第2要素がタイムスタンプである。Clockオブジェクトが指定された 場合はClockが最後にリセットされてからの時間が返される。 =============== =================================================================================================== .. Returns a list of keys that were pressed. .. Parameters: .. keyList .. : None or [] .. Allows the user to specify a set of keys to check for. Only keypresses from this set of keys will be removed from the keyboard buffer. If the keyList is None all keys will be checked and the key buffer will be cleared completely. 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. Each tuple has (keyname, modifiers). The modifiers are a dict of keyboard modifier flags keyed by the modifier name (eg. ‘shift’, ‘ctrl’). .. timeStamped .. : False, True, or Clock .. If True will return a list of tuples instead of a list of keynames. Each tuple has (keyname, time). If a core.Clock is given then the time will be relative to the Clock‘s last reset.