Simple GUI Calculator in Python

  Рет қаралды 231,170

NeuralNine

NeuralNine

2 жыл бұрын

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/

Пікірлер: 177
@wko_
@wko_ 2 жыл бұрын
Very simple and very useful! Thanks for one more project like this!
@BrendanBurkartSF
@BrendanBurkartSF 8 ай бұрын
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!
@nipoteemus2472
@nipoteemus2472 2 жыл бұрын
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!
@arslanuzakov988
@arslanuzakov988 Жыл бұрын
i really like that thats the first youtube project thats works without error, thank you sir
@efogovirtual9635
@efogovirtual9635 9 ай бұрын
I appreciate you, this is absolutely useful, nice tutorial
@thatgarryman9400
@thatgarryman9400 4 ай бұрын
Literally explained better than half of the programmers in KZbin. Makes sense, explains, doesn't do unnecessary stuff.
@cannafarmer
@cannafarmer 2 жыл бұрын
Thank you for the videos I like to scan them quick when i'm stuck
@AbubakarMulla23
@AbubakarMulla23 2 жыл бұрын
Love your coding bro... Stay going on..
@scratchersdotcom9336
@scratchersdotcom9336 Жыл бұрын
Very nice tutorial. I very well understood. Really appreciate it 👏
@deeparose2926
@deeparose2926 2 жыл бұрын
Loved it!!
@tomasg101
@tomasg101 Жыл бұрын
Thank you dude, I´m learning Python and this was perfect to achieve new knowledge Greetins from Argentina
@haokaixuan
@haokaixuan 2 жыл бұрын
love these projects!
@user-mz9ql7oc9j
@user-mz9ql7oc9j Жыл бұрын
Very simple and very useful! Thanks ❤ 🇲🇦
@anonymspro7864
@anonymspro7864 2 жыл бұрын
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 :) :) :) :) ;) ;)
@bonyimakaveli633
@bonyimakaveli633 Жыл бұрын
Big thanks man. Really appreciate what you do.
@DC_Luxurious_Cars_
@DC_Luxurious_Cars_ 9 ай бұрын
I really enjoyed this. Thank you very much.
@yadobeatz359
@yadobeatz359 10 ай бұрын
very simle and helpful a lot, thank you a lot
@tortu_nashe
@tortu_nashe 8 ай бұрын
nice vid liked n subed , made me feelike programming more
@arnavmeena525
@arnavmeena525 2 жыл бұрын
NeuralNine: *Making Calculator and is doing calculations on it* Also NeuralNine: Am gonna do the calculations myself. Who needs a calculator?
@exxavier1695
@exxavier1695 7 ай бұрын
I love the project it was very useful and helpful thanks
@sarveshsargunan4914
@sarveshsargunan4914 Жыл бұрын
i learned a lot from this video and i did it myself as well
@100mikedaniel6
@100mikedaniel6 2 жыл бұрын
Stay on the upload grind!
@NeuralNine
@NeuralNine 2 жыл бұрын
one video every other day! 💪🏻
@AlexMuseMatrix
@AlexMuseMatrix Ай бұрын
Try 4 videos Every day, It's a great schedule 😎@@NeuralNine
@himanshuranjansingh6134
@himanshuranjansingh6134 2 жыл бұрын
Thank you man🌻
@user-wv1kr2pz1q
@user-wv1kr2pz1q Жыл бұрын
Interesting explanation ❤
@tsmghost
@tsmghost 2 жыл бұрын
Already made that but still learnt something new❤️❤️❤️
@theminecrafttree8913
@theminecrafttree8913 2 жыл бұрын
nice flex
@theminecrafttree8913
@theminecrafttree8913 2 жыл бұрын
the best tutorial ever bro u da best
@fayazshams-rd3ek
@fayazshams-rd3ek Жыл бұрын
Really really really Great i wish you more success ❤❤❤
@kennethlourisombrog2149
@kennethlourisombrog2149 4 ай бұрын
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.
@feliperodrigues3277
@feliperodrigues3277 Жыл бұрын
You're the best one to explain, ty so much man
@rushikeshmali3057
@rushikeshmali3057 17 күн бұрын
Thanks for beautiful guidens
@rezalapriani1001
@rezalapriani1001 2 жыл бұрын
i learn from your video, thanks you soo much
@patibandlalatha7530
@patibandlalatha7530 5 ай бұрын
Very much helpful to the python learners
@dieelitezwerge7622
@dieelitezwerge7622 Жыл бұрын
thanks for another very nice video😇😉
@lerserk
@lerserk 11 ай бұрын
19:46 Its the lambda bro!! Thank you for this!
@EBKCS_DHRUV_SHARMA
@EBKCS_DHRUV_SHARMA 9 ай бұрын
man i love you, best is what i think you are!!!!
@RahulKumar-cm1sy
@RahulKumar-cm1sy 8 күн бұрын
Thank you sir ❤
@rodinicen689
@rodinicen689 2 ай бұрын
Very nice video! More of this! :D
@maitruong7909
@maitruong7909 5 ай бұрын
Awesome! 10 points
@zhangchill1616
@zhangchill1616 6 ай бұрын
Very simple Thank yous
@davidianmusic4869
@davidianmusic4869 7 ай бұрын
Thanks!
@piklif5278
@piklif5278 Жыл бұрын
this helped me so mauch thax
@surfineer
@surfineer Жыл бұрын
Interesting explanation on the eval() functionality. But what alternatives would you suggest for better security?
@ubidubium836
@ubidubium836 Жыл бұрын
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
@skystep2 11 ай бұрын
I am noob, but I would not allowed letters, only go execute eval if there are no letters and other not allowed symbols
@v11r
@v11r 7 ай бұрын
You need to implement a tree
@sianbunny7724
@sianbunny7724 2 ай бұрын
thnx man 🙏
@alirezaahmadivand831
@alirezaahmadivand831 2 жыл бұрын
Thanks a lot 🙏
@sithhill
@sithhill 11 ай бұрын
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.
@brendanjordan5485
@brendanjordan5485 Жыл бұрын
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
@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
@TheRealStrider 8 ай бұрын
@@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
@oadeep 7 ай бұрын
thank you so much it works@@TheRealStrider
@KatherineHunt-bz9fg
@KatherineHunt-bz9fg 4 ай бұрын
Learning python on a calculator
@tummatantewadonprasit639
@tummatantewadonprasit639 Ай бұрын
Tysm❤❤😊
@akellner2
@akellner2 6 ай бұрын
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.
@noir66146
@noir66146 Жыл бұрын
my kind of tutorial
@fzel1
@fzel1 3 ай бұрын
the amount of time he takes to build the calculator is so impressive
@paulmwangi270
@paulmwangi270 11 ай бұрын
The tutorial was topnotch
@yoonesaghtaii8991
@yoonesaghtaii8991 2 ай бұрын
thanks bro❤
@soufatldude700
@soufatldude700 Ай бұрын
do you need pycharm for this, or can you use the normal python application?
@user-sz1iq3tu3f
@user-sz1iq3tu3f 7 ай бұрын
what program that using for python?
@svetlanadelrey973
@svetlanadelrey973 5 ай бұрын
i would love if u explained what are you doing in ur actions
@akshar088
@akshar088 2 ай бұрын
amazing
@evoamer2686
@evoamer2686 3 ай бұрын
You have made me switch from C# to python my friend
@PCANDPOCO
@PCANDPOCO 7 күн бұрын
thank you very much
@housemajaliwa
@housemajaliwa 10 ай бұрын
Good stuff
@Tom-ks9xl
@Tom-ks9xl 4 ай бұрын
Fantastic
@flowereye3720
@flowereye3720 2 жыл бұрын
Thank you
@harshalpatil2618
@harshalpatil2618 8 ай бұрын
Super vdo
@therumblemain
@therumblemain 8 ай бұрын
so usefull and hepfull I subsribed this is my 2nd videio watching
@wise_beanss
@wise_beanss 11 ай бұрын
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)
@Victory-py7lp
@Victory-py7lp 2 ай бұрын
Can someone explain why he uses the .delete first before the .insert? What does that do?
@support_gaza
@support_gaza 11 ай бұрын
You needed 2 minutes to figure out the problem but you still didn't figure it but got another solution but my solution was after 2 secs after I saw the code and it is to put brackets after evaluate_calculation and it worked with me 😅
@aradthetyper2101
@aradthetyper2101 Жыл бұрын
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
@poorvinalavade8651 Жыл бұрын
even i want to know the meaning of those parameters
@timmyt1232
@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)
@affenkratzer
@affenkratzer 2 ай бұрын
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
@Victory-py7lp
@Victory-py7lp 2 ай бұрын
Thank you so much.
@Soo-qd1co
@Soo-qd1co 2 ай бұрын
thank buddy 🙏
@Victory-py7lp
@Victory-py7lp 2 ай бұрын
Can you please explain why he .delete came before the .insert?
@affenkratzer
@affenkratzer 2 ай бұрын
@@Victory-py7lp because of the grid placement you need to change it
@Void-Dev
@Void-Dev Жыл бұрын
For the buttons why not just use a definition?
@user-qt4jh1lq6s
@user-qt4jh1lq6s 2 ай бұрын
Thanks
@ethan_haymore3907
@ethan_haymore3907 Ай бұрын
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
@Al_X-2005
@Al_X-2005 2 ай бұрын
Now that I can make custom buttons I can finally create the Calculator 2
@swarnarekha578
@swarnarekha578 2 жыл бұрын
0:42 when he said nonsense haha
@brany2920
@brany2920 Жыл бұрын
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
@anirudhpm7155
@anirudhpm7155 11 ай бұрын
How can i add √ and on off button could you please help me.
@caw986
@caw986 Жыл бұрын
hi good video all in all but the code keeps on throwing the error message at me when i perform any calculations
@Tom-ks9xl
@Tom-ks9xl 3 ай бұрын
What interface are you using? Looks very good. The standard IDE isn't as nice as this
@N7ShepardSR
@N7ShepardSR 3 ай бұрын
PyCharm its really good
@Tom-ks9xl
@Tom-ks9xl 3 ай бұрын
Thank you i found it and installed it right onto linux. It's a very nice interface and handy.
@cheesefries6616
@cheesefries6616 Жыл бұрын
could anyone explain more about the text_result.delete(1.0, "error") and text_result.insert(1.0, calculation). I'm confused as hell
@mariustrelea5132
@mariustrelea5132 2 жыл бұрын
Can you implement it with constants e and π , and also trigonometric functions
@flowman8414
@flowman8414 2 жыл бұрын
well do try to do it yourself
@mariustrelea5132
@mariustrelea5132 2 жыл бұрын
@@flowman8414 import math has trigonometric functions and also the inverse functions of themselves ?
@flowman8414
@flowman8414 2 жыл бұрын
@@mariustrelea5132 yea i think so
@anakin.gulliver
@anakin.gulliver 2 жыл бұрын
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
@LyricZ 2 жыл бұрын
import tkinter
@googlegoogle1610
@googlegoogle1610 2 жыл бұрын
i like your video but why not to paste the code in the description
@iumamaiftikhar
@iumamaiftikhar Жыл бұрын
sir i have a problem on line 5 iwrote it correct what should i do
@Hunter-kd4gi
@Hunter-kd4gi 3 ай бұрын
SyntaxError: expected 'except' or 'finally' block
@speedev
@speedev 2 жыл бұрын
Thx.
@NeuralNine
@NeuralNine 2 жыл бұрын
^^
@Knowmemelife
@Knowmemelife 6 ай бұрын
Brow what will I do if on calculator I click 1 and the result is always calculation
@HardeepSingh-ec4zq
@HardeepSingh-ec4zq Ай бұрын
How can I add percentage button in this program
@reskretny20
@reskretny20 5 ай бұрын
he looks like Nacho from Better call Saul
@jokemiri
@jokemiri Жыл бұрын
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
@youngistaan5883 7 ай бұрын
And also there should ve back space
@Cheezou.
@Cheezou. 2 жыл бұрын
Where is the code , i wanna compare with mine pls
@ernurernur303
@ernurernur303 Жыл бұрын
hey guys , how to add backspace function ? if you know pliss
@hemanmoriya8237
@hemanmoriya8237 2 ай бұрын
I made the project the completely but I didn't learned many things from it because it was copy paste time type program for me .
@Soo-qd1co
@Soo-qd1co 2 ай бұрын
which code editor did you use? I used codesandbox and don't show the pop up page for blank page for... import tkinter as tk calculation = "" def add_to_calculation(symbol): pass def evaluate_calculation(): pass def clear_field(): pass root = tk.Tk() root.geometry("300x275") root.mainloop() and shows up Traceback (most recent call last): File "calculator.py", line 18, in root = tk.Tk() File "/usr/local/lib/python3.8/tkinter/__init__.py", line 2270, in __init__ self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use) _tkinter.TclError: no display name and no $DISPLAY environment variable
@hemanmoriya8237
@hemanmoriya8237 2 ай бұрын
@@Soo-qd1co I used pycharm for python development
@skitmc5842
@skitmc5842 2 ай бұрын
17:17 (just a marker so i can skip back into the video without losing where i was before)
@kingkoller1503
@kingkoller1503 4 ай бұрын
Great tutorial! But in my case (I don't know why) I have to use lambda for all functions so that it would work. And also the result of the previous calculation isn't transferred to the new one. Does anybody know what's wrong?
@shouryathakur9643
@shouryathakur9643 3 ай бұрын
idk
@fzel1
@fzel1 3 ай бұрын
show ur code
@AnthonyKenny-wl5ud
@AnthonyKenny-wl5ud Жыл бұрын
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?
@nellcid7909
@nellcid7909 Жыл бұрын
how to fix "text_result" is not defined error?
@unknown-cz5yh
@unknown-cz5yh Жыл бұрын
error is occuring when i am adding 1+1 how to solve this problem
@user-pm5bx5tg4g
@user-pm5bx5tg4g 2 ай бұрын
After lambda add to command is not showing in blue colour
@leadgebrat9880
@leadgebrat9880 Жыл бұрын
The delete function is not working... Gives an Attribute error
@SnowNight
@SnowNight Жыл бұрын
intro music name?
C++ Developer Learns Python
9:26
PolyMars
Рет қаралды 2,6 МЛН
Python calculator app 🖩
15:08
Bro Code
Рет қаралды 64 М.
Stupid man 👨😂
00:20
Nadir Show
Рет қаралды 23 МЛН
ISSEI funny story😂😂😂Strange World | Pink with inoCat
00:36
ISSEI / いっせい
Рет қаралды 20 МЛН
КАРМАНЧИК 2 СЕЗОН 4 СЕРИЯ
24:05
Inter Production
Рет қаралды 637 М.
INO IS A KIND ALIEN😂
00:45
INO
Рет қаралды 21 МЛН
SAP-BI/BW On HANA 7.5 Real Time Online Training Live Session
18:43
Build this JS calculator in 15 minutes! 🖩
15:20
Bro Code
Рет қаралды 310 М.
Python 101: Learn the 5 Must-Know Concepts
20:00
Tech With Tim
Рет қаралды 1 МЛН
Compiled Python is FAST
12:57
Doug Mercer
Рет қаралды 79 М.
Tkinter Beginner Course - Python GUI Development
38:59
NeuralNine
Рет қаралды 453 М.
3 PYTHON AUTOMATION PROJECTS FOR BEGINNERS
17:00
Internet Made Coder
Рет қаралды 1,4 МЛН
How to Make a Game in Python
43:01
Tech With Tim
Рет қаралды 348 М.
I made Games with Python for 10 Years...
28:52
DaFluffyPotato
Рет қаралды 206 М.
5 Mini Python Projects - For Beginners
1:41:08
Tech With Tim
Рет қаралды 2,7 МЛН
САМЫЙ дешевый ПК с OZON на RTX 4070
16:16
Мой Компьютер
Рет қаралды 103 М.
How much charging is in your phone right now? 📱➡️ 🔋VS 🪫
0:11