picoterm and conio
Terminal helpers for text-based interfaces.
picoterm
import picoterm
assert picoterm.wcswidth('hello') == 5
assert picoterm.wcswidth('\x1b[31mhello\x1b[0m') == 5
coordinates = []
assert picoterm.sscanf('12,34', '%d,%d', coordinates)
assert coordinates == [12, 34]
Width estimates use the module's character rules, not a complete grapheme or
terminal-emulator model. The parser supports integer fields and exact literal
characters, not the complete C scanf format language. It clears the output
list before parsing and can leave partial results after a mismatch.
conio
On desktop targets with PK_ENABLE_OS=1, conio._kbhit() reports keyboard
input availability and conio._getch() reads a character code without ordinary
line-buffered input. These functions require an appropriate terminal and are
not a portable browser/mobile input API.
For an embedded UI, prefer the application's own input events and output callbacks.
API declarations: picoterm.pyi, conio.pyi.