def createGraphProcess(functions, domain, gRange): # Format the expressions so they are ready to be graphed funcArg = [GraphUtils.formatExpression(f) for f in functions] funcArg = GraphUtils.replaceCalls(funcArg) funcArg = [GraphUtils.nestFunctions(e[1], funcArg[:e[0]] + funcArg[e[0] + 1:]) for e in enumerate(funcArg)] # Open the graphing subprocess return subprocess.Popen(["python", sys.path[1] + "/Graphing.py", str(len(funcArg))] + funcArg + [domain,gRange])
def updateResults(rng): formatted = map(lambda frame: GraphUtils.formatExpression(frame[6].get()), fList[rng[0]: rng[1]]) replaced = GraphUtils.replaceCalls(formatted) for i in range(len(replaced)): replaced[i] = GraphUtils.nestFunctions(replaced[i], replaced[:i] + replaced[i + 1:]) for i in range(len(replaced)): frame = fList[i + rng[0]] eq = replaced[i] # Calculate the result of the entered equation result = MathCalc.readEquation(GraphUtils.removeDependant(eq)) resultType = type(result) types = [int, long, float] # Display the result of calculation below the text box if resultType in types: frame[7].set("= " + str(result)) frame[3].grid(columnspan=1000) else: frame[3].grid_forget()