Calculator using tkinter | Sololearn: Learn to code for FREE!

0

Calculator using tkinter

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

5/27/2022 6:38:20 PM

Yasamin F

10 Answers

New Answer

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.

+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.

0

What do you mean? Does it work? Great. If not, then whats the issue?

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.

0

So why does It work now?what is the difference between grid and place?

0

Yes it works now.but this is my first tkinter project and I want to know if there is any recommendations.

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.

0

Thank you very much. I’ll try to learn about it. Also I saved the code on my device you can delete it.

0

ok.

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