sge.keyboard

This module provides functions related to keyboard input.

sge.keyboard Functions

sge.keyboard.get_pressed(key)[source]

Return whether or not a key is pressed.

See the documentation for sge.input.KeyPress for more information.

sge.keyboard.get_modifier(key)[source]

Return whether or not a modifier key is being held.

Arguments:

  • key – The identifier string of the modifier key to check; see the table below.
Modifier Key Name Identifier String
Alt "alt"
Left Alt "alt_left"
Right Alt "alt_right"
Ctrl "ctrl"
Left Ctrl "ctrl_left"
Right Ctrl "ctrl_right"
Meta "meta"
Left Meta "meta_left"
Right Meta "meta_right"
Shift "shift"
Left Shift "shift_left"
Right Shift "shift_right"
Mode "mode"
Caps Lock "caps_lock"
Num Lock "num_lock"
sge.keyboard.get_focused()[source]

Return whether or not the game has keyboard focus.

sge.keyboard.set_repeat(enabled=True, interval=0, delay=0)[source]

Set repetition of key press events.

Arguments:

  • enabled – Whether or not to enable repetition of key press events.
  • interval – The time in milliseconds in between each repeated key press event.
  • delay – The time in milliseconds to wait after the first key press event before repeating key press events.

If enabled is set to true, this causes a key being held down to generate additional key press events as long as it remains held down.

sge.keyboard.get_repeat_enabled()[source]

Return whether or not repetition of key press events is enabled.

See the documentation for sge.keyboard.set_repeat() for more information.

sge.keyboard.get_repeat_interval()[source]

Return the interval in between each repeated key press event.

See the documentation for sge.keyboard.set_repeat() for more information.

sge.keyboard.get_repeat_delay()[source]

Return the delay before repeating key press events.

See the documentation for sge.keyboard.set_repeat() for more information.