New submission from nova <nova.par...@gmx.com>:
Package : python(v3.6.9) Severity: normal When a window object has been created using curses.newwin(), increasing the terminal size produces the KEY_RESIZE events, but getmaxyx() returns the previous terminal size. Only by decreasing the terminal size does it return the correct terminal dimensions. Attachment includes: 1. video demonstrating the effect Following is the script to reproduce the effect: import curses def init_curses(): curses.initscr() window = curses.newwin(curses.LINES - 1, curses.COLS, 0, 0) # window = curses.initscr() curses.raw() curses.noecho() curses.cbreak() window.keypad(True) return window def restore_terminal(window): curses.noraw() curses.nocbreak() window.keypad(False) curses.echo() curses.endwin() def main(): try: window = init_curses() resize_no = 0 maxy, maxx = window.getmaxyx() dimension_string = "resize_no: " + str(resize_no) + ". maxy: " + str(maxy) + "; maxx: " + str(maxx) + '\n' window.addstr(dimension_string) while True: ch = window.getch() window.clear() if ch == curses.KEY_RESIZE: resize_no += 1 maxy, maxx = window.getmaxyx() dimension_string = "resize_no: " + str(resize_no) + ". maxy: " + str(maxy) + "; maxx: " + str(maxx) + '\n' window.addstr(dimension_string) finally: restore_terminal(window) if __name__ == '__main__': main() ---------- components: Extension Modules files: bug_curses.mp4 messages: 360849 nosy: nova priority: normal severity: normal status: open title: window.getmaxyx() doesn't return updated height when window is resized type: behavior versions: Python 3.6 Added file: https://bugs.python.org/file48868/bug_curses.mp4 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39475> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com