win32console
Interface for interacting with windows api console functions.
The core export is the enable_virtual_processing
context manager that redirects
console input events and inputs them as ascii codes; this includes mouse input.
Credits
- Implementation: Tired-Fox (Zachary)
StdDevice
Bases: Enum
The available standard devices for windows.
Source code in pytermgui/win32console.py
52 53 54 55 56 57 |
|
enable_virtual_processing()
Dummy context manager for non windows systems
Source code in pytermgui/win32console.py
148 149 150 151 152 153 154 |
|
get_console_mode(std)
Get the console mode for the given standard device.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
std |
HANDLE
|
The handle to the standard device to get the settings from |
required |
Returns:
Name | Type | Description |
---|---|---|
False |
DWORD
|
when setting the mode fails |
Source code in pytermgui/win32console.py
74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
get_std_handle(handle=StdDevice.OUT)
Retrieves a handle to the specified standard device (stdin, stdout, stderr)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
handle |
int
|
Indentifier for the standard device. Defaults to -11 (stdout). |
StdDevice.OUT
|
Returns:
Type | Description |
---|---|
HANDLE
|
wintypes.HANDLE: Handle to the standard device |
Source code in pytermgui/win32console.py
59 60 61 62 63 64 65 66 67 68 |
|
set_console_mode(std, mode)
Set the console mode for the given standard device.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
std |
HANDLE
|
The handle to the standard device |
required |
mode |
int
|
The mode / setting flags to set to the device |
required |
Returns:
Type | Description |
---|---|
bool
|
False when setting the mode fails |
Source code in pytermgui/win32console.py
88 89 90 91 92 93 94 95 96 97 98 |
|