Python ncurses program stops working when resizing command prompt to mininimum size

43 views Asked by At

I'm currently facing a problem where my program seems to work fine when the windows cmd has a height of at least 3 rows. However when the cmd is resized smaller than that, ncurses stops updating the cmd dimensions (self.x, self.y) which breaks my program even when the cmd is resized to a 'normal' size afterwards.

If been having quite a bit of resizing problems with ncurses in Python besides this one. Is this a known problem or am I missing something here?


    def run(self):
        self.update_screen()

        while True:
            c = self.stdscr.getch()
            
            if c == ord('q'):
                break
            elif c == curses.KEY_RESIZE:
                try:
                    self.resize()
                    self.update_screen()
                except Exception as e:
                    print(e)

    def resize(self):
        self.y, self.x = self.stdscr.getmaxyx()
        ... # Windows that will get resized based on the new y and x.

I can't seem to find an answer on google that fixes this problem.

Pastebin: https://pastebin.com/F7aYnMBP

0

There are 0 answers