(LOGO.JPG) Python for OpenVMS

(go to: table of contents, index, list of vms_smg, prev: MOVE_VIRTUAL_DISPLAY, next: PASTE_VIRTUAL_DISPLAY)


NAME_TO_KEYCODE - Translate a Key Name into a Key Code

Translate the key name of a key on the keyboard into its associated key code. The opposite function is vms_smg.keycode_to_name().

Format:

    key_code = vms_smg.name_to_keycode (key_name)
Returns:
key_code
The key code as translated from the key_name. Symbolic names like SMG_K_TRM_PF2 are in module 'vms_smgdef'.
Arguments:
key_name
The name of the key to be translated into the key_code. key_name is simply the name of the key (for example, COMMA, PERIOD, KP4, and so forth).
Examples:
>>> import vms_smg
>>> import vms_smgdef

>>> key_code = vms_smg.name_to_keycode ('PF2')
>>> print key_code, vms_smgdef.SMG_K_TRM_PF2
257 257
>>>

----------------------------------------

>>> print vms_smg.name_to_keycode ('*BAD*')
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_smg.error: (1213466, '%SMG-E-INVKEYNAM, invalid key name')
>>>

>>> print vms_smg.name_to_keycode (0)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: argument 1: expected read-only buffer, int found
>>>

(go to: table of contents, index, list of vms_smg, prev: MOVE_VIRTUAL_DISPLAY, next: PASTE_VIRTUAL_DISPLAY)

10-SEP-2000 ZE.