Simple GUI Calculator in Python
Vložit
- čas přidán 24. 07. 2021
- 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/ - Věda a technologie
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 CZcams. Makes sense, explains, doesn't do unnecessary stuff.
Very simple and very useful!
Thanks for one more project like this!
I appreciate you, this is absolutely useful, nice tutorial
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!
Love your coding bro... Stay going on..
I really enjoyed this. Thank you very much.
Loved it!!
Big thanks man. Really appreciate what you do.
very simle and helpful a lot, thank you a lot
Very simple and very useful!
Thanks ❤ 🇲🇦
love these projects!
Thank you dude, I´m learning Python and this was perfect to achieve new knowledge
Greetins from Argentina
Thank you for the videos I like to scan them quick when i'm stuck
Very nice tutorial. I very well understood. Really appreciate it 👏
i really like that thats the first youtube project thats works without error, thank you sir
now i can not agree it dosent wor to me
NeuralNine: *Making Calculator and is doing calculations on it*
Also NeuralNine: Am gonna do the calculations myself. Who needs a calculator?
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 :) :) :) :) ;) ;)
bro thank you very much. you made my day. keep up
Very nice video! More of this! :D
I love the project it was very useful and helpful thanks
Interesting explanation ❤
Really really really Great i wish you more success ❤❤❤
nice vid liked n subed , made me feelike programming more
thanks for another very nice video😇😉
Already made that but still learnt something new❤️❤️❤️
nice flex
i learned a lot from this video and i did it myself as well
the best tutorial ever bro u da best
Thank you man🌻
man i love you, best is what i think you are!!!!
i learn from your video, thanks you soo much
Very much helpful to the python learners
You're the best one to explain, ty so much man
Stay on the upload grind!
one video every other day! 💪🏻
Try 4 videos Every day, It's a great schedule 😎@@NeuralNine
19:46 Its the lambda bro!!
Thank you for this!
Awesome! 10 points
Very simple Thank yous
Thanks for beautiful guidens
this helped me so mauch thax
Learning python on a calculator
Thats a classic chad move
Thanks a lot 🙏
the amount of time he takes to build the calculator is so impressive
Thank you sir ❤
Fantastic
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.
The tutorial was topnotch
Good stuff
You have made me switch from C# to python my friend
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.
Thanks!
amazing
thanks bro❤
my kind of tutorial
Thank you
thnx man
🙏
thank you very much
Can someone explain why he uses the .delete first before the .insert? What does that do?
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)
so usefull and hepfull I subsribed this is my 2nd videio watching
Tysm❤❤😊
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.
0:42 when he said nonsense haha
i would love if u explained what are you doing in ur actions
Interesting explanation on the eval() functionality. But what alternatives would you suggest for better security?
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.
I am noob, but I would not allowed letters, only go execute eval if there are no letters and other not allowed symbols
You need to implement a tree
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
How can i add √ and on off button could you please help me.
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
For the buttons why not just use a definition?
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)"
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.
@@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
thank you so much it works@@TheRealStrider
Thanks
Now that I can make custom buttons I can finally create the Calculator 2
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?
even i want to know the meaning of those parameters
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)
@@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?
hi good video all in all but the code keeps on throwing the error message at me when i perform any calculations
Super vdo
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.
import tkinter
sir i have a problem on line 5 iwrote it correct what should i do
Thx.
^^
Brow what will I do if on calculator I click 1 and the result is always calculation
he looks like Nacho from Better call Saul
could anyone explain more about the text_result.delete(1.0, "error") and text_result.insert(1.0, calculation). I'm confused as hell
how to fix "text_result" is not defined error?
i like your video but why not to paste the code in the description
How do you do the copy paste trick??? damn. It seems like it's a shortcut key or somethin' it was so quick ahahahhah
How can I add percentage button in this program
Computerphile has an interesting approach to evaluating equations using functional programming: czcams.com/video/7tCNu4CnjVc/video.html
20:24, do equals without the lambda
hey guys , how to add backspace function ? if you know pliss
The delete function is not working... Gives an Attribute error
After lambda add to command is not showing in blue colour
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!
error is occuring when i am adding 1+1 how to solve this problem
What interface are you using? Looks very good. The standard IDE isn't as nice as this
PyCharm its really good
Thank you i found it and installed it right onto linux. It's a very nice interface and handy.
Where is the code , i wanna compare with mine pls
thx, I can flex now xD.
intro music name?
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.
And also there should ve back space
When i click the number are error, can you repair my code?
SyntaxError: expected 'except' or 'finally' block
i have also a function if you want to remove one character from the calculation if you made an error typing, but you need an extra delete button for it:
def remove():
global calculation
if calculation:
calculation = calculation[:-1]
text_result.delete(1.0, "end")
text_result.insert(1.0, calculation)
pass
pass
Thank you so much.
thank buddy 🙏
Can you please explain why he .delete came before the .insert?
@@Victory-py7lp because of the grid placement you need to change it
Can you implement it with constants e and π , and also trigonometric functions
well do try to do it yourself
@@flowman8414 import math has trigonometric functions and also the inverse functions of themselves ?
@@mariustrelea5132 yea i think so