Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Curses Handling Window (Terminal) Resize

This is two questions really:

  • how do I resize a curses window, and
  • how do I deal with a terminal resize in curses?

Is it possible to know when a window has changed size?

I really can't find any good doc, not even covered on http://docs.python.org/library/curses.html

like image 680
Pez Cuckow Avatar asked Mar 01 '11 23:03

Pez Cuckow


1 Answers

Terminal resize event will result in the curses.KEY_RESIZE key code. Therefore you can handle terminal resize as part of a standard main loop in a curses program, waiting for input with getch.

like image 168
Michael McLoughlin Avatar answered Sep 21 '22 17:09

Michael McLoughlin