def key_event_to_name ( event ):
    key_code = event.GetKeyCode()
    if event.ControlDown() and (1 <= key_code <= 26):
        key = chr( key_code + 96 )
    else:
        key = key_map.get( key_code )
        if key is None:
            try:
                key = chr( key_code )
            except:
                # Handle the case of strange keyboard codes (such as the Apple
                # keyboard 'apple' key):
                key = 'unknown'

    name = ''
    if event.AltDown():
        name = 'Alt'

    if event.ControlDown():
        name += '-Ctrl'

    if event.ShiftDown() and ((name != '') or (len( key ) > 1)):
        name += '-Shift'

    if key == ' ':
        key = 'Space'

    if len( name ) > 0:
        key = key.lower()

    name += ('-' + key)

    if name[:1] == '-':
        return name[1:]
    return name
Converts a keystroke event into a corresponding key name.
dataset/ETHPy150Open enthought/traitsui/traitsui/wx/key_event_to_name.py/key_event_to_name