Simple GUI Calculator in Python
Ғылым және технология
Today we build a simple GUI calculator in Python. For the graphical user interface we use tkinter.
◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
📚 Programming Books & Merch 📚
🐍 The Python Bible Book: www.neuralnine.com/books/
💻 The Algorithm Bible Book: www.neuralnine.com/books/
👕 Programming Merch: www.neuralnine.com/shop
🌐 Social Media & Contact 🌐
📱 Website: www.neuralnine.com/
📷 Instagram: / neuralnine
🐦 Twitter: / neuralnine
🤵 LinkedIn: / neuralnine
📁 GitHub: github.com/NeuralNine
🎙 Discord: / discord
🎵 Outro Music From: www.bensound.com/
Пікірлер: 189
Very simple and very useful! Thanks for one more project like this!
this was super helpful and really well done! I actually really liked that you had the lambda still in there for the btn_equals...it let us see your debugging process. Thank you!
Literally explained better than half of the programmers in KZread. Makes sense, explains, doesn't do unnecessary stuff.
I appreciate you, this is absolutely useful, nice tutorial
NeuralNine: *Making Calculator and is doing calculations on it* Also NeuralNine: Am gonna do the calculations myself. Who needs a calculator?
I really enjoyed this. Thank you very much.
very simle and helpful a lot, thank you a lot
Loved it!!
Thanks for the tutorial! I have that kind of school project where I have to make a representation of your favorite hobby or that stuff! I planned to make it about coding and I'm trying to do 3 softwares for it and this is fricking good idea!
Thank you for the videos I like to scan them quick when i'm stuck
Love your coding bro... Stay going on..
Thank you dude, I´m learning Python and this was perfect to achieve new knowledge Greetins from Argentina
Big thanks man. Really appreciate what you do.
Great bro i was finding this only from a long time.Thanks for uploading in this Content.I'm excited for your next video please upload it as soon as possible :) :) :) :) ;) ;)
Very nice video! More of this! :D
I love the project it was very useful and helpful thanks
Very simple and very useful! Thanks ❤ 🇲🇦
love these projects!
nice vid liked n subed , made me feelike programming more
Very nice tutorial. I very well understood. Really appreciate it 👏
Thank you man🌻
the best tutorial ever bro u da best
Interesting explanation ❤
thanks for another very nice video😇😉
i learn from your video, thanks you soo much
Stay on the upload grind!
@NeuralNine
3 жыл бұрын
one video every other day! 💪🏻
@AlexMuseMatrix
3 ай бұрын
Try 4 videos Every day, It's a great schedule 😎@@NeuralNine
man i love you, best is what i think you are!!!!
Already made that but still learnt something new❤️❤️❤️
@theminecrafttree8913
2 жыл бұрын
nice flex
Thanks for beautiful guidens
Really really really Great i wish you more success ❤❤❤
i learned a lot from this video and i did it myself as well
i really like that thats the first youtube project thats works without error, thank you sir
@Lejo1_LV
Ай бұрын
now i can not agree it dosent wor to me
Very simple Thank yous
Very much helpful to the python learners
Learning python on a calculator
@abhinavgangwar4690
Ай бұрын
Thats a classic chad move
How does this do the actual math portion without telling it to do a math calculation? The other calculator I made doesn't have a GUI but all the code is to specify the actual math method being used versus, all we (you) did was create buttons. I followed along and just don't understand how it's automatically doing the math.
this helped me so mauch thax
Thank you for sharing, I wonder how I can implement an %-Button with the correct function. I tried it but I can`t figure it out.
Awesome! 10 points
Nice. Do you think I can include this in my portfolio to apply for a job? I can say that I followed your tutorial and learned from it.
19:46 Its the lambda bro!! Thank you for this!
is it possible to make a delete button? If so how do you do it, cos i have been trying to figure it out for the past week, but still can’t (i’m a beginner btw)
Can someone explain why he uses the .delete first before the .insert? What does that do?
Thanks a lot 🙏
Thank you sir ❤
You're the best one to explain, ty so much man
thank you very much
How can i add √ and on off button could you please help me.
i have tried installing this Tkinter but still wouldnt work on my window 10 or my mac pro. its so confusing i get this error : "ModuleNotFoundError: No module named '_tkinter'" what do i do
Fantastic
everything worked but the buttons only work individually instead of 1+2 it would just say the number by itself when clicked instead of holding memory. any tips or advice
Thanks!
Good stuff
hi good video all in all but the code keeps on throwing the error message at me when i perform any calculations
thanks bro❤
For the buttons why not just use a definition?
You have made me switch from C# to python my friend
sir i have a problem on line 5 iwrote it correct what should i do
thnx man 🙏
The tutorial was topnotch
the amount of time he takes to build the calculator is so impressive
i would love if u explained what are you doing in ur actions
could anyone explain more about the text_result.delete(1.0, "error") and text_result.insert(1.0, calculation). I'm confused as hell
Thank you
Tysm❤❤😊
amazing
Thank you for the video! If I want to make it so that I don't have to type a '*' before the parenthesis for the code to recognize that it should multiply, how do I make it so that this code recognizes that 'x(a)", where x and a are any number , are suppose to multiply? Like if I want it to calculate "90/3(1+2)"
@jeez8136
Жыл бұрын
i was wondering that too so i asked chatgpt and this is what it said: To make the code recognize this implicit multiplication, you can add a check in the add_to_calculation function to see if the last symbol in the calculation string is a number, and if so, add the multiplication symbol before adding the parentheses. Here is an updated add_to_calculation function that implements this logic: def add_to_calculation(symbol): global calculation if symbol == "(" and calculation != "" and calculation[-1].isdigit(): calculation += "*" calculation += str(symbol) text_result.delete(1.0, "end") text_result.insert(1.0, calculation) With this code, if the user types a number followed by an opening parenthesis, the function will automatically insert a multiplication symbol before the parenthesis. This means that if the user types "90/3(1+2)", the calculation string will become "90/3*(1+2)" before evaluation.
@TheRealStrider
10 ай бұрын
@@jeez8136 So I was wondering this as well and have finally made it work behind the scenes without it showing it add the * before the (. Here is the code: implicit = list(calculation) i = 0 while i
@oadeep
9 ай бұрын
thank you so much it works@@TheRealStrider
Interesting explanation on the eval() functionality. But what alternatives would you suggest for better security?
@GeovaniLopesDias
Жыл бұрын
I didn't watched it with audio on, so I don't know what security issues he mentioned, but I was wondering the whole video when would he write the regex code to interpret the string arithmetic expression. It'd require some extra functions to substitute the eval() built-in. For personal challenge, we could try to code these said extra functions.
@skystep2
Жыл бұрын
I am noob, but I would not allowed letters, only go execute eval if there are no letters and other not allowed symbols
@v11r
9 ай бұрын
You need to implement a tree
How can I add percentage button in this program
Thanks
How do you do the copy paste trick??? damn. It seems like it's a shortcut key or somethin' it was so quick ahahahhah
my kind of tutorial
hey guys , how to add backspace function ? if you know pliss
Brow what will I do if on calculator I click 1 and the result is always calculation
Can anyone explain to me how he navigates the code by highlighting a single character then just skimming it? I'm a bit new to coding and am still learning much. - Thanks!
how to fix "text_result" is not defined error?
brilliant! just one thing. i don't get the part where you put (1.0, "end") after text_result.delete or text_result.insert. what do they mean?
@poorvinalavade8651
Жыл бұрын
even i want to know the meaning of those parameters
@timmyt1232
Жыл бұрын
In tkinter (for text), delete(first index position, last index position). The 1 is first line. The 0 is before first character. The "end" is to the end of the text. insert(index position, string)
@Himlajchan
Ай бұрын
@@timmyt1232 Would you mind explaining where this 'end' argument is defined? Tried to look into the source via PyCharm, but couldn't find where this is specified, not even in any documentation that I looked trough. How can I know what other strings are valid for the index parameter?
After lambda add to command is not showing in blue colour
When i click the number are error, can you repair my code?
can you help me? I get the error: ModuleNotFoundError: No module named 'tkinter' when i tri to do the first test run. I cant seem to get it to work on any ide expect on python terminal alone.
@LyricZ
2 жыл бұрын
import tkinter
The delete function is not working... Gives an Attribute error
Really enjoyed this, thanks! All of the buttons are present and in the correct spot, but when I click key, the text "calculation" appears and not the actual digits. Any ideas?
error is occuring when i am adding 1+1 how to solve this problem
intro music name?
Now that I can make custom buttons I can finally create the Calculator 2
Where is the code , i wanna compare with mine pls
so usefull and hepfull I subsribed this is my 2nd videio watching
What interface are you using? Looks very good. The standard IDE isn't as nice as this
@N7ShepardSR
5 ай бұрын
PyCharm its really good
@Tom-ks9xl
5 ай бұрын
Thank you i found it and installed it right onto linux. It's a very nice interface and handy.
do you need pycharm for this, or can you use the normal python application?
@reaction_124
Ай бұрын
hi gojo kun
@soufatldude700
Ай бұрын
@@reaction_124 Nah i'd win.
I just completed this. Is it possible to clear the screen after a result when a new number is keyed? Thank you for the tutorial.
@youngistaan5883
9 ай бұрын
And also there should ve back space
How to delete one number?
for some reason line 19 isnt working ofr me at 3:43 through 3 :53
he looks like Nacho from Better call Saul
0:42 when he said nonsense haha
i like your video but why not to paste the code in the description
Can you implement it with constants e and π , and also trigonometric functions
@flowman8414
3 жыл бұрын
well do try to do it yourself
@mariustrelea5132
3 жыл бұрын
@@flowman8414 import math has trigonometric functions and also the inverse functions of themselves ?
@flowman8414
3 жыл бұрын
@@mariustrelea5132 yea i think so
SyntaxError: expected 'except' or 'finally' block
there is still somehow a small problem with my code, as except additions, nothing else works and it just does (e.g.) 3x3=Error
@onemangamer587
Жыл бұрын
Are you using "*" or "x"? Because "x" will throw an error
It keeps showing tk not defined
Thx.
@NeuralNine
3 жыл бұрын
^^