Class KeyCodes

Info

The KeyCodes give access to many of keyboard keys and keyboard modifiers.

KeyCodes contains a few methods for aiding in the creation of keyboard commands to developer can avoid using Low level keyboard string.

Class

class odevgui_win.kind.keys_kind.KeyCodes(value)[source]

Key Codes Constants

ALT = 'VK_MENU'
BACK = 'BACK'
BACKSPACE = 'BACKSPACE'
BKSP = 'BKSP'
BREAK = 'BREAK'
BS = 'BS'
CAP = 'CAP'
CAPSLOCK = 'CAPSLOCK'
CTL = 'VK_CONTROL'
DEL = 'DEL'
DELETE = 'DELETE'
DOWN = 'DOWN'
END = 'END'
ENTER = 'ENTER'
ESC = 'ESC'
F1 = 'F1'
F10 = 'F10'
F11 = 'F11'
F12 = 'F12'
F13 = 'F13'
F14 = 'F14'
F15 = 'F15'
F16 = 'F16'
F17 = 'F17'
F18 = 'F18'
F19 = 'F19'
F2 = 'F2'
F20 = 'F20'
F21 = 'F21'
F22 = 'F22'
F23 = 'F23'
F24 = 'F24'
F3 = 'F3'
F4 = 'F4'
F5 = 'F5'
F6 = 'F6'
F7 = 'F7'
F8 = 'F8'
F9 = 'F9'
HELP = 'HELP'
HOME = 'HOME'
INS = 'INS'
INSERT = 'INSERT'
LEFT = 'LEFT'
LWIN = 'LWIN'
NUMLOCK = 'NUMLOCK'
PGDN = 'PGDN'
PGUP = 'PGUP'
PRTSC = 'PRTSC'
RIGHT = 'RIGHT'
RMENU = 'RMENU'
RWIN = 'RWIN'
SCROLLLOCK = 'SCROLLLOCK'
SHIFT = 'VK_SHIFT'
SPACE = 'SPACE'
TAB = 'TAB'
UP = 'UP'
VK_ACCEPT = 'VK_ACCEPT'
VK_ADD = 'VK_ADD'
VK_APPS = 'VK_APPS'
VK_ATTN = 'VK_ATTN'
VK_BACK = 'VK_BACK'
VK_CANCEL = 'VK_CANCEL'
VK_CAPITAL = 'VK_CAPITAL'
VK_CLEAR = 'VK_CLEAR'
VK_CONTROL = 'VK_CONTROL'
VK_CONVERT = 'VK_CONVERT'
VK_CRSEL = 'VK_CRSEL'
VK_DECIMAL = 'VK_DECIMAL'
VK_DELETE = 'VK_DELETE'
VK_DIVIDE = 'VK_DIVIDE'
VK_DOWN = 'VK_DOWN'
VK_END = 'VK_END'
VK_EREOF = 'VK_EREOF'
VK_ESCAPE = 'VK_ESCAPE'
VK_EXECUTE = 'VK_EXECUTE'
VK_EXSEL = 'VK_EXSEL'
VK_F1 = 'VK_F1'
VK_F10 = 'VK_F10'
VK_F11 = 'VK_F11'
VK_F12 = 'VK_F12'
VK_F13 = 'VK_F13'
VK_F14 = 'VK_F14'
VK_F15 = 'VK_F15'
VK_F16 = 'VK_F16'
VK_F17 = 'VK_F17'
VK_F18 = 'VK_F18'
VK_F19 = 'VK_F19'
VK_F2 = 'VK_F2'
VK_F20 = 'VK_F20'
VK_F21 = 'VK_F21'
VK_F22 = 'VK_F22'
VK_F23 = 'VK_F23'
VK_F24 = 'VK_F24'
VK_F3 = 'VK_F3'
VK_F4 = 'VK_F4'
VK_F5 = 'VK_F5'
VK_F6 = 'VK_F6'
VK_F7 = 'VK_F7'
VK_F8 = 'VK_F8'
VK_F9 = 'VK_F9'
VK_FINAL = 'VK_FINAL'
VK_HANGEUL = 'VK_HANGEUL'
VK_HANGUL = 'VK_HANGUL'
VK_HANJA = 'VK_HANJA'
VK_HELP = 'VK_HELP'
VK_HOME = 'VK_HOME'
VK_INSERT = 'VK_INSERT'
VK_JUNJA = 'VK_JUNJA'
VK_KANA = 'VK_KANA'
VK_KANJI = 'VK_KANJI'
VK_LBUTTON = 'VK_LBUTTON'
VK_LCONTROL = 'VK_LCONTROL'
VK_LEFT = 'VK_LEFT'
VK_LMENU = 'VK_LMENU'
VK_LSHIFT = 'VK_LSHIFT'
VK_LWIN = 'VK_LWIN'
VK_MBUTTON = 'VK_MBUTTON'
VK_MENU = 'VK_MENU'
VK_MODECHANGE = 'VK_MODECHANGE'
VK_MULTIPLY = 'VK_MULTIPLY'
VK_NEXT = 'VK_NEXT'
VK_NONAME = 'VK_NONAME'
VK_NONCONVERT = 'VK_NONCONVERT'
VK_NUMLOCK = 'VK_NUMLOCK'
VK_NUMPAD0 = 'VK_NUMPAD0'
VK_NUMPAD1 = 'VK_NUMPAD1'
VK_NUMPAD2 = 'VK_NUMPAD2'
VK_NUMPAD3 = 'VK_NUMPAD3'
VK_NUMPAD4 = 'VK_NUMPAD4'
VK_NUMPAD5 = 'VK_NUMPAD5'
VK_NUMPAD6 = 'VK_NUMPAD6'
VK_NUMPAD7 = 'VK_NUMPAD7'
VK_NUMPAD8 = 'VK_NUMPAD8'
VK_NUMPAD9 = 'VK_NUMPAD9'
VK_OEM_CLEAR = 'VK_OEM_CLEAR'
VK_PA1 = 'VK_PA1'
VK_PAUSE = 'VK_PAUSE'
VK_PLAY = 'VK_PLAY'
VK_PRINT = 'VK_PRINT'
VK_PRIOR = 'VK_PRIOR'
VK_PROCESSKEY = 'VK_PROCESSKEY'
VK_RBUTTON = 'VK_RBUTTON'
VK_RCONTROL = 'VK_RCONTROL'
VK_RETURN = 'VK_RETURN'
VK_RIGHT = 'VK_RIGHT'
VK_RMENU = 'VK_RMENU'
VK_RSHIFT = 'VK_RSHIFT'
VK_RWIN = 'VK_RWIN'
VK_SCROLL = 'VK_SCROLL'
VK_SELECT = 'VK_SELECT'
VK_SEPARATOR = 'VK_SEPARATOR'
VK_SHIFT = 'VK_SHIFT'
VK_SNAPSHOT = 'VK_SNAPSHOT'
VK_SPACE = 'VK_SPACE'
VK_SUBTRACT = 'VK_SUBTRACT'
VK_TAB = 'VK_TAB'
VK_UP = 'VK_UP'
ZOOM = 'ZOOM'
static get_key(codes: KeyCodes | str | Sequence[KeyCodes], direction: KeyDirection = KeyDirection.NONE) str[source]

Gets a keyboard sequence from arguments.

Parameters:
  • codes (KeyCodes | str | Sequence[KeyCodes]) – Key code such as KeyCodes.F5 or r or KeyCodes.ALT

  • direction (KeyDirection, optional) – Key Direction. Defaults to KeyDirection.NONE.

Returns:

Representing Keyboard enulation such as {F5} or {r} or {VK_MENU down}

Return type:

str

static get_many_keys(codes: KeyCodes | Sequence[KeyCodes], *keys: str | KeyCodes) str[source]

Gets keyboard sequence for mulitple keys at onece.

Parameters:
  • codes (KeyCodes | Sequence[KeyCodes]) – Press and release commands

  • *keys – Optional Expanded list of keys to wrape in Press and Release commands

Returns:

Sequenece of keyboard commands

Return type:

str

Example

>>> str_cmd = KeyCodes.get_many_keys(KeyCodes.ALT, "v", "c", "r")
>>> print(str_cmd)
 '{VK_MENU down}v{VK_MENU up}{VK_MENU down}c{VK_MENU up}{VK_MENU down}r{VK_MENU up}'
static get_up_down(codes: KeyCodes | str | Sequence[KeyCodes], key: str | KeyCodes, repeat: int = 1) str[source]

Gets a keyboard sequence from arguments that containd press (donw) and release (up) commands.

Parameters:
  • codes (KeyCodes | str | Sequence[KeyCodes]) – Press and release command(s)

  • key (str | KeyCodes) – Key to wrap in press and release command

  • repeat (int, optional) – Number of times to repead commands. Useful when repeated command is needed such as ALT+v, ALT+v. Defaults to 1.

Returns:

key wraped in updown commands.

Return type:

str

Example

>>> str_cmd = KeyCodes.get_up_down((KeyCodes.CTL, KeyCodes.SHIFT), "j")
>>> print(str_cmd)
 '{VK_CONTROL down}{VK_SHIFT down}j{VK_CONTROL up}{VK_SHIFT up}'