Class SendKeyInfo

Info

Class is used to pass virtual key informaton to relevant methods. See Class RobotKeys

Class

class odevgui_win.class_args.send_key_info.SendKeyInfo(keys: str)[source]

Window Title Info

static from_code(code: KeyCodes) SendKeyInfo[source]

Gets a SendKeyInfo instance

Parameters:

code (KeyCodes) – code used to create instance

Returns:

New Instance

Return type:

SendKeyInfo

Example

The following example demonstrates toggling Cap Lock

>>> key_info = SendKeyInfo.from_code(KeyCodes.CAPSLOCK)
>>> print(key_info.keys)
{CAPSLOCK}
static from_code_sequence_str(codes: Sequence[KeyCodes], key: str | KeyCodes) SendKeyInfo[source]
static from_code_sequence_str(codes: Sequence[KeyCodes], key: str | KeyCodes, repeat: int) SendKeyInfo

Gets a SendKeyInfo instance

Parameters:
  • codes (Sequence[KeyCodes]) – Sequence of codes

  • key (str | KeyCodes) – Key such as t

  • repeat (int, optional) – Number of times to repeat the sequence. Defaults to 1.

Returns:

New Instance

Return type:

SendKeyInfo

Example

The following example demonstrates setting to Alt+s

>>> key_info = SendKeyInfo.from_code_sequence_str((KeyCodes.SHIFT, KeyCodes.ALT), "t")
>>> print(key_info.keys)
{VK_SHIFT down}{VK_MENU down}t{VK_SHIFT up}{VK_MENU up}
static from_code_str(code: KeyCodes, key: str | KeyCodes) SendKeyInfo[source]
static from_code_str(code: KeyCodes, key: str | KeyCodes, repeat: int) SendKeyInfo

Gets a SendKeyInfo instance

Parameters:
  • code (KeyCodes) – code such as KeyCodes.ALT

  • key (str | KeyCodes) – Key such as s

  • repeat (int, optional) – Number of times to repeat the sequence. Defaults to 1.

Returns:

New Instance

Return type:

SendKeyInfo

Example

The following example demonstrates setting to Alt+s

>>> key_info = SendKeyInfo.from_code_str(KeyCodes.ALT, "s")
>>> print(key_info.keys)
{VK_MENU down}s{VK_MENU up}
static from_key(codes: KeyCodes, *keys: str | KeyCodes) SendKeyInfo[source]

Gets a SendKeyInfo instance

Parameters:

codes (KeyCodes) – code or codes to set

Returns:

New Instance

Return type:

SendKeyInfo

Example

The following example demonstrates thoe to set keys to send Alt+o, Alt+x, Alt+c

>>> key_info = SendKeyInfo.from_keys(KeyCodes.ALT, "o", "x", "c")
>>> print(key_info.keys)
{VK_MENU down}o{VK_MENU up}{VK_MENU down}x{VK_MENU up}{VK_MENU down}c{VK_MENU up}
static from_keys(codes: Sequence[KeyCodes], *keys: str | KeyCodes) SendKeyInfo[source]

Gets a SendKeyInfo instance

Parameters:

codes (Sequence[KeyCodes]) – codes to set

Returns:

New Instance

Return type:

SendKeyInfo

Example

The following example demonstrates thoe to set keys to send Alt+o, Alt+x, Alt+c

>>> key_info = SendKeyInfo.from_keys((KeyCodes.SHIFT, KeyCodes.CTL), "o", "x", "c")
>>> print(key_info.keys)
{VK_SHIFT down}{VK_CONTROL down}o{VK_SHIFT up}{VK_CONTROL up}{VK_SHIFT down}{VK_CONTROL down}x{VK_SHIFT up}{VK_CONTROL up}{VK_SHIFT down}{VK_CONTROL down}c{VK_SHIFT up}{VK_CONTROL up}
keys: str

Keys to send