The terminal emulators we run so many of our programming tools in are more powerful than we remember to give them credit for, and the key to that power is understanding the interface. This talk will cover terminal colors and styles, writing to arbitrary portions of the screen, handling signals from the terminal, determining the terminal’s dimensions and scrollback buffer behavior.
Terminal programming can get hairy; along the way we’ll deal with encoding issues, consider cross platform concerns, acknowledge 4 decades’ worth of standards for terminal communication, and consider that humans at interactive terminals may not be the only users of our interfaces. By gaining an understanding of these issues, we’ll be able choose from the abstractions over them offered by Python libraries Urwid, Blessings, and Python Prompt Toolkit.
This talk requires minimal Python knowledge, but does assume familiarity with command line tools in a unix environment.
An abbreviated version of this talk was presented at PyCon 2015 in Montréal: https://www.youtube.com/watch?v=WAitSilLDUA With the additional time I’d hope to present more code examples, a more in-depth tour of existing libraries and more practical advice about writing programs that use the terminal, and an additional example of a difficult terminal details: dealing with reflowing of text in modern terminal emulators like GNOME Terminal and iTerm.