Calculator using tkinter | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Calculator using tkinter

https://code.sololearn.com/cKlXCIrfGgh8/?ref=app How can I improve my program?

27th May 2022, 6:38 PM
Yasamin F
10 Answers
0
Yasamin F the modified code is too long to paste into a post here, so I saved it in a python code below. Please copy it to your own file and inform me if you did so I can delete my file later. I already have too many miscellaneous codes in my code collection.
28th May 2022, 7:49 AM
Bob_Li
Bob_Li - avatar
+ 1
Yes I think I will start learning oop next week in university. But in this project I wanted to use the things I’ve learned till now. Btw thank you very much.
29th May 2022, 11:16 AM
Yasamin F
0
What do you mean? Does it work? Great. If not, then whats the issue?
27th May 2022, 7:17 PM
Slick
Slick - avatar
0
Yasamin F no display because you did not use tk.mainloop() you used global in the functions but did not define them initially in the program. the widgets should be positioned using grid.
27th May 2022, 10:44 PM
Bob_Li
Bob_Li - avatar
0
So why does It work now?what is the difference between grid and place?
28th May 2022, 5:55 AM
Yasamin F
0
Yes it works now.but this is my first tkinter project and I want to know if there is any recommendations.
28th May 2022, 6:01 AM
Yasamin F
0
Yasamin F for calculator, it is easier to arrange the widgets using grid since you do not have to worry about the absolute position, only the row and column where it is placed. Also, you have the option on pad and span, among other things. tk.mainloop() or variations of it is essential in tkinter codes. It is what renders the gui and listen for callbacks to execute the functions and refresh the widgets. recommend to learn about containers and frames to organize your widgets.
28th May 2022, 7:40 AM
Bob_Li
Bob_Li - avatar
0
Thank you very much. I’ll try to learn about it. Also I saved the code on my device you can delete it.
28th May 2022, 8:01 AM
Yasamin F
0
ok.
28th May 2022, 8:03 AM
Bob_Li
Bob_Li - avatar
0
Yasamin F When you learn about oop, you could try this calculator. Building a calculator this way is more dynamic, since the parameters are more organized and easier to change. https://dev.to/abdurrahmaanj/building-an-oop-calculator-and-what-it-means-to-write-a-widget-library-4560
28th May 2022, 9:15 AM
Bob_Li
Bob_Li - avatar