Jul-27-2023, 08:47 PM
I have some code that just prints the same thing over and over and its numbered but when I try scrolling up it doesn't work, But I wanna be able to scroll up using mouse scroll wheel and have like the actual scrollbar present and using keys such as pg up ect... like in a normal terminal. Now I do know curses just overlays on-top of the terminal that's why I'm wondering if there is a way to do all of this?
Thank you in advance.
import curses, time def print_hello(chat_win): num = 0 while True: chat_win.addstr(f"Test Bot. {num} \n") chat_win.refresh() time.sleep(0.5) num += 1 stdscr = curses.initscr() curses.noecho() curses.cbreak() stdscr.keypad(True) curses.curs_set(0) chat_win = curses.newwin(curses.LINES, curses.COLS, 0, 0) chat_win.scrollok(True) print_hello(chat_win)Currently it just prints and whatever goes off screen at the top(previous old text) gets deleted entirety.
Thank you in advance.