python wrapper for VT100 escape sequences, which are supported by most modern terminals (on linux at least).
pip3 install py100
from py100 import py100
py100.some_function_from_the_table_below()
This is the list of what is currently supported and what should be supported in the future. If a sequence isn't marked as planned it may just mean I didn't have a look at it yet.
Sequence | Description | Name | Supported | Planned | Function |
---|---|---|---|---|---|
Esc[20h | Set new line mode | LMN | ✔️ | ✔️ | set_new_line_mode() |
Esc[?1h | Set cursor key to application | DECCKM | ✔️ | ✔️ | set_cursor_key_to_application() |
Esc[?3h | Set number of columns to 132 | DECCOLM | ✔️ | ✔️ | set_columns_to_132() |
Esc[?4h | Set smooth scrolling | DECSCLM | ✔️ | ✔️ | set_smooth_scrolling() |
Esc[?5h | Set reverse video on screen | DECSCNM | ✔️ | ✔️ | set_reverse_video_on_screen() |
Esc[?6h | Set origin to relative | DECOM | ✔️ | ✔️ | set_origin_relative() |
Esc[?7h | Set auto-wrap mode | DECAWM | ✔️ | ✔️ | set_auto_wrap_mode() |
Esc[?8h | Set auto-repeat mode | DECARM | ✔️ | ✔️ | set_auto_repeat_mode() |
Esc[?9h | Set interlacing mode | DECINLM | ✔️ | ✔️ | set_interlacing_mode() |
Esc[20l | Set line feed mode | LMN | ✔️ | ✔️ | set_line_feed_mode() |
Esc[?1l | Set cursor key to cursor | DECCKM | ✔️ | ✔️ | set_cursor_to_key_mode() |
Esc[?2l | Set VT52 (versus ANSI) | DECANM | ✔️ | ✔️ | set_vt52() |
Esc[?3l | Set number of columns to 80 | DECCOLM | ✔️ | ✔️ | set_columns_to_80() |
Esc[?4l | Set jump scrolling | DECSCLM | ✔️ | ✔️ | set_jump_scrolling() |
Esc[?5l | Set normal video on screen | DECSCNM | ✔️ | ✔️ | set_normal_video_on_screen() |
Esc[?6l | Set origin to absolute | DECOM | ✔️ | ✔️ | set_origin_absolute() |
Esc[?7l | Reset auto-wrap mode | DECAWM | ✔️ | ✔️ | reset_auto_wrap_mode() |
Esc[?8l | Reset auto-repeat mode | DECARM | ✔️ | ✔️ | reset_auto_repeat_mode() |
Esc[?9l | Reset interlacing mode | DECINLM | ✔️ | ✔️ | reset_interlacing_mode() |
Esc= | Set alternate keypad mode | DECKPAM | ✔️ | ✔️ | set_alternate_keypad_mode() |
Esc> | Set numeric keypad mode | DECKPNM | ✔️ | ✔️ | set_numeric_keypad_mode() |
Esc(A | Set United Kingdom G0 character set | setukg0 | ✔️ | ✔️ | set_united_kingdom_g0_character_set() |
Esc)A | Set United Kingdom G1 character set | setukg1 | ✔️ | ✔️ | set_united_kingdom_g1_character_set() |
Esc(B | Set United States G0 character set | setusg0 | ✔️ | ✔️ | set_united_states_g0_character_set() |
Esc)B | Set United States G1 character set | setusg1 | ✔️ | ✔️ | set_united_states_g1_character_set() |
Esc(0 | Set G0 special chars. & line set | setspecg0 | ✔️ | ✔️ | set_g0_special_chars_and_line_set() |
Esc)0 | Set G1 special chars. & line set | setspecg1 | ✔️ | ✔️ | set_g1_special_chars_and_line_set() |
Esc(1 | Set G0 alternate character ROM | setaltg0 | ✔️ | ✔️ | set_g0_alternate_character_rom() |
Esc)1 | Set G1 alternate character ROM | setaltg1 | ✔️ | ✔️ | set_g1_alternate_character_rom() |
Esc(2 | Set G0 alt char ROM and spec. graphics | setaltspecg0 | ✔️ | ✔️ | set_g0_alt_char_rom_and_spec_graphics() |
Esc)2 | Set G1 alt char ROM and spec. graphics | setaltspecg1 | ✔️ | ✔️ | set_g1_alt_char_rom_and_spec_graphics() |
EscN | Set single shift 2 | SS2 | ✔️ | ✔️ | set_single_shift_2() |
EscO | Set single shift 3 | SS3 | ✔️ | ✔️ | set_single_shift_3() |
Esc[m | Turn off character attributes | SGR0 | ✔️ | ✔️ | turn_off_characters_attributes() |
Esc[0m | Turn off character attributes | SGR0 | ✔️ | ✔️ | turn_off_characters_attributes() |
Esc[1m | Turn bold mode on | SGR1 | ✔️ | ✔️ | turn_bold_mode_on() |
Esc[2m | Turn low intensity mode on | SGR2 | ✔️ | ✔️ | turn_low_intensity_mode_on() |
Esc[4m | Turn underline mode on | SGR4 | ✔️ | ✔️ | turn_underline_mode_on() |
Esc[5m | Turn blinking mode on | SGR5 | ✔️ | ✔️ | turn_blinking_mode_on() |
Esc[7m | Turn reverse video on | SGR7 | ✔️ | ✔️ | turn_reverse_video_mode_on() |
Esc[8m | Turn invisible text mode on | SGR8 | ✔️ | ✔️ | turn_invisible_text_mode_on() |
Esc[Line;Liner | Set top and bottom lines of a window | DECSTBM | ✔️ | ✔️ | set_top_and_bottom_lines_of_a_window(top_line, bottom_line) |
Esc[ValueA | Move cursor up n lines | CUU | ✔️ | ✔️ | move_cursor_up(nb_line) |
Esc[ValueB | Move cursor down n lines | CUD | ✔️ | ✔️ | move_cursor_down(nb_line) |
Esc[ValueC | Move cursor right n lines | CUF | ✔️ | ✔️ | move_cursor_right(nb_line) |
Esc[ValueD | Move cursor left n lines | CUB | ✔️ | ✔️ | move_cursor_left(nb_line) |
Esc[H | Move cursor to upper left corner | cursorhome | ✔️ | ✔️ | move_cursor_upper_left() |
Esc[;H | Move cursor to upper left corner | cursorhome | ✔️ | ✔️ | move_cursor_upper_left() |
Esc[Line;ColumnH | Move cursor to screen location v,h | CUP | ✔️ | ✔️ | move_cursor_to_location() |
Esc[f | Move cursor to upper left corner | hvhome | ✔️ | ✔️ | move_cursor_upper_left() |
Esc[;f | Move cursor to upper left corner | hvhome | ✔️ | ✔️ | move_cursor_upper_left() |
Esc[Line;Columnf | Move cursor to screen location v,h | CUP | ✔️ | ✔️ | move_cursor_to_location(hpos, vpos) |
EscD | Move/scroll window up one line | IND | ✔️ | ✔️ | scroll_window_up() |
EscM | Move/scroll window down one line | RI | ✔️ | ✔️ | scroll_window_down() |
EscE | Move to next line | NEL | ✔️ | ✔️ | move_to_next_line() |
Esc7 | Save cursor position and attributes | DECSC | ✔️ | ✔️ | save_cursor_position() |
Esc8 | Restore cursor position and attributes | DECSC | ✔️ | ✔️ | restore_cursor_position() |
EscH | Set a tab at the current column | HTS | ✔️ | ✔️ | set_a_tab_at_the_current_column() |
Esc[g | Clear a tab at the current column | TBC | ✔️ | ✔️ | clear_a_tab_at_the_current_column() |
Esc[0g | Clear a tab at the current column | TBC | ✔️ | ✔️ | clear_a_tab_at_the_current_column() |
Esc[3g | Clear all tabs | TBC | ✔️ | ✔️ | clear_all_tabs() |
Esc#3 | Double-height letters, top half | DECDHL | ✔️ | ✔️ | double_height_letters_top_half() |
Esc#4 | Double-height letters, bottom half | DECDHL | ✔️ | ✔️ | double_height_letters_bottom_half() |
Esc#5 | Single width, single height letters | DECSWL | ✔️ | ✔️ | single_width_single_height_letters() |
Esc#6 | Double width, single height letters | DECDWL | ✔️ | ✔️ | double_width_single_height_letters() |
Esc[K | Clear line from cursor right | EL0 | ✔️ | ✔️ | clear_line_from_cursor_right() |
Esc[0K | Clear line from cursor right | EL0 | ✔️ | ✔️ | clear_line_from_cursor_right() |
Esc[1K | Clear line from cursor left | EL1 | ✔️ | ✔️ | clear_line_from_cursor_left() |
Esc[2K | Clear entire line | EL2 | ✔️ | ✔️ | clear_entire_line() |
Esc[J | Clear screen from cursor down | ED0 | ✔️ | ✔️ | clear_line_from_cursor_down() |
Esc[0J | Clear screen from cursor down | ED0 | ✔️ | ✔️ | clear_line_from_cursor_down() |
Esc[1J | Clear screen from cursor up | ED1 | ✔️ | ✔️ | clear_line_from_cursor_up() |
Esc[2J | Clear entire screen | ED2 | ✔️ | ✔️ | clear_screen() |
Esc5n | Device status report | DSR | ✔️ | ||
Esc0n | Response: terminal is OK | DSR | ✔️ | ||
Esc3n | Response: terminal is not OK | DSR | ✔️ | ||
Esc6n | Get cursor position | DSR | ✔️ | ✔️ | get_cursor_position() |
EscLine;ColumnR | Response: cursor is at v,h | CPR | ✔️ | ✔️ | get_cursor_position() |
Esc[c | Identify what terminal type | DA | ✔️ | ||
Esc[0c | Identify what terminal type (another) | DA | ✔️ | ||
Esc[?1;Value0c | Response: terminal type code n | DA | ✔️ | ||
Escc | Reset terminal to initial state | RIS | ✔️ | ✔️ | reset_terminal_to_initial_state() |
Esc#8 | Screen alignment display | DECALN | ✔️ | ✔️ | screen_alignment_display() |
Esc[2;1y | Confidence power up test | DECTST | |||
Esc[2;2y | Confidence loopback test | DECTST | |||
Esc[2;9y | Repeat power up test | DECTST | |||
Esc[2;10y | Repeat loopback test | DECTST | |||
Esc[0q | Turn off all four leds | DECLL0 | ✔️ | ✔️ | turn_off_all_four_leds() |
Esc[1q | Turn on LED #1 | DECLL1 | ✔️ | ✔️ | turn_on_led_1() |
Esc[2q | Turn on LED #2 | DECLL2 | ✔️ | ✔️ | turn_on_led_2() |
Esc[3q | Turn on LED #3 | DECLL3 | ✔️ | ✔️ | turn_on_led_3() |
Esc[4q | Turn on LED #4 | DECLL4 | ✔️ | ✔️ | turn_on_led_4() |
Information on all the VT100 escape sequences can be found here (This is where my list comes from).
More information on the DEC Terminals can be found on vt100.net.