import curses from curses import wrapper from windows import StaticWindow from windows import InputWindow def main(stdscr): stdscr.clear() stdscr.refresh y, x = stdscr.getmaxyx() ch = 0 text = "" while (ch!=24): stdscr.clear() stdscr.refresh calculate = StaticWindow((x//2)-len(text)//2-3, (y//2)+4, text,"",True) calculate.draw() curses.curs_set(1) function = InputWindow((x//2)-5, (y//2)-5, 10, 3, "function", 6) xInput = InputWindow((x//2)-5, (y//2)-2, 10, 3, "x", x) yInput = InputWindow((x//2)-5, (y//2)+1, 10, 3, "y", x) function.draw() xInput.draw() yInput.draw() try: function = int(function.editResize()) xInput = int(xInput.editResize()) yInput = int(yInput.editResize()) text = "нет такой операции" curses.curs_set(0) if function == 1: text = f"x+y={xInput+yInput}" elif function == 2: text = f"x-y={xInput-yInput}" elif function == 3: text = f"x*y={xInput*yInput}" elif function == 4: text = f"x/y={xInput//yInput}" calculate.clear() except: pass calculate = StaticWindow((x//2)-len(text)//2-3, (y//2)+4, text,"",True) calculate.draw() ch = stdscr.getch() wrapper(main)