def showStack(stack, buf): clear() try: print(stack) except KeyboardInterrupt: clear() print('too large to display!') stack.rpnView(buf)
def getch(): rawChar = rawGetch() if rawChar == 'Q': # naive escape clear() print("bye.") exit() else: inpChar = rawChar return inpChar
def showCalc(stack, buf, errors): ''' If there are errors, display those. Then show the "screen" of the calculator. ''' clear() nonErrors = { '', None, '\n' } if errors not in nonErrors: print(errors) stack.rpnView(buf) # correct view for HP calcs
def main(): while True: clear() print(intro) sym = input("] ") if sym is 'Q': clear() print("bye.") exit() elif sym is 'q': break elif sym is '?': for key in ops.bindings.keys(): print(key) null = input(pause) elif sym in ops.bindings.keys(): getHelp(sym) null = input(pause) else: print("not available!") null = input(pause)