Grapher
- 4 Devlogs
- 4 Total hours
Graphing calculator using Tkinter
Graphing calculator using Tkinter
I added an animation function using a clever tool called .after(). It basically updates something after a given amount if time. I just converted the locations given to me from the eval() function to pixel locations and created circles that update every millisecond and that creates an effect of an animation. I also added an ‘‘clear’’ button because i can’t just reset the animations as i can with the normal plot function.
So i added a minimum nd aximum functions for both equations. If you press the corresponding button it creates a dashed line through the global maximum/minimum of the function. Here’s how it works: First apoint gets selected. Than it checks if the point is bigger than an another point that is a pixel away from that point. If the next point is bigger, the next point becomes the fiirst point essentially. The code does that until the next point is smaller than the current point and it stores that point as max_y. Than it continues until it finds yet another point whose next point is smaller than the point. The code than chcecks if this point’s bigger than max_y and if it is than this point becomes max_y. And so on till it checks the entire function.
Ive added a second equation therefore a 2nd graph. After yuo plot the graph you can find the intercept of the 2 graphs. This took a lot of a shorter time to make and i happy about that. It shoes that im getting more accustomed to tkinter and programming in general. Also i think the code to find the intercpet is pretty neat so im going to paste it in for pixel_x in range(450): x = (pixel_x - 450/2) / k try: y1 = eval(rovnica1) y2 = eval(rovnica2) rozdiel = abs(y1-y2) if rozdiel < najmensi_rozdiel: najmensi_rozdiel = rozdiel priesecnik_x = pixel_x priesecnik_y = 225 - (y1 * k) except: continue
Before thisi worked on the project for an another hour but it didnt get allocated to my project. Im working with support to get that fixed. During these @ hours or so i finished the model UI im going to add a lot more functions and buttons also i moght add an anmiation.