Simple GUI Calculator in Python

  Рет қаралды 298,951

NeuralNine

NeuralNine

Күн бұрын

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...
💻 The Algorithm Bible Book: www.neuralnine...
👕 Programming Merch: www.neuralnine...
🌐 Social Media & Contact 🌐
📱 Website: www.neuralnine...
📷 Instagram: / neuralnine
🐦 Twitter: / neuralnine
🤵 LinkedIn: / neuralnine
📁 GitHub: github.com/Neu...
🎙 Discord: / discord
🎵 Outro Music From: www.bensound.com/

Пікірлер: 208
@thatgarryman9400
@thatgarryman9400 Жыл бұрын
Literally explained better than half of the programmers in KZbin. Makes sense, explains, doesn't do unnecessary stuff.
@BrendanBurkartSF
@BrendanBurkartSF Жыл бұрын
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!
@marcosvalencia1883
@marcosvalencia1883 4 ай бұрын
Yes
@arslanuzakov988
@arslanuzakov988 2 жыл бұрын
i really like that thats the first youtube project thats works without error, thank you sir
@Lejo1_LV
@Lejo1_LV 8 ай бұрын
now i can not agree it dosent wor to me
@arnavmeena525
@arnavmeena525 3 жыл бұрын
NeuralNine: *Making Calculator and is doing calculations on it* Also NeuralNine: Am gonna do the calculations myself. Who needs a calculator?
@lerserk
@lerserk Жыл бұрын
19:46 Its the lambda bro!! Thank you for this!
@wko_
@wko_ 3 жыл бұрын
Very simple and very useful! Thanks for one more project like this!
@100mikedaniel6
@100mikedaniel6 3 жыл бұрын
Stay on the upload grind!
@NeuralNine
@NeuralNine 3 жыл бұрын
one video every other day! 💪🏻
@AlexMuseMatrix
@AlexMuseMatrix 10 ай бұрын
Try 4 videos Every day, It's a great schedule 😎@@NeuralNine
@xxpotatoxx1080p
@xxpotatoxx1080p Ай бұрын
so good will use my own calculator from now on
@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!
@Veestar4u
@Veestar4u 11 ай бұрын
Can someone explain why he uses the .delete first before the .insert? What does that do?
@fzel1
@fzel1 Жыл бұрын
the amount of time he takes to build the calculator is so impressive
@andaluzski
@andaluzski 5 ай бұрын
I've always wanted to learn to program and this video helped me understand that my biggest enemy is going to be my dyslexia xD
@tsmghost
@tsmghost 3 жыл бұрын
Already made that but still learnt something new❤️❤️❤️
@theminecrafttree8913
@theminecrafttree8913 2 жыл бұрын
nice flex
@AbubakarMulla23
@AbubakarMulla23 3 жыл бұрын
Love your coding bro... Stay going on..
@soufatldude700
@soufatldude700 10 ай бұрын
do you need pycharm for this, or can you use the normal python application?
@reaction_124
@reaction_124 8 ай бұрын
hi gojo kun
@soufatldude700
@soufatldude700 8 ай бұрын
@@reaction_124 Nah i'd win.
@efogovirtual9635
@efogovirtual9635 Жыл бұрын
I appreciate you, this is absolutely useful, nice tutorial
@deeparose2926
@deeparose2926 3 жыл бұрын
Loved it!!
@AbhayGupta-oz1ix
@AbhayGupta-oz1ix 6 ай бұрын
This is what i was looking for. Thanks to tutor.
@shaunakwasker20
@shaunakwasker20 4 ай бұрын
super helpful and clear, thanks a lot
@cannafarmer
@cannafarmer 3 жыл бұрын
Thank you for the videos I like to scan them quick when i'm stuck
@tomasg101
@tomasg101 2 жыл бұрын
Thank you dude, I´m learning Python and this was perfect to achieve new knowledge Greetins from Argentina
@haokaixuan
@haokaixuan 3 жыл бұрын
love these projects!
@scratchersdotcom9336
@scratchersdotcom9336 2 жыл бұрын
Very nice tutorial. I very well understood. Really appreciate it 👏
@finpas9915
@finpas9915 Ай бұрын
Great Video. Thank you very much!🙏🙏🙏
@rodinicen689
@rodinicen689 11 ай бұрын
Very nice video! More of this! :D
@MAhmed12_5
@MAhmed12_5 6 ай бұрын
bro thank you very much. you made my day. keep up
@sithhill
@sithhill Жыл бұрын
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.
@johnbishoppp
@johnbishoppp 3 ай бұрын
I think it's the eval() function that's doing the math. At 5:30 he mentions that the eval function will evaluate both mathematical equations as well as code.
@القراءةمفتاحالعلم
@القراءةمفتاحالعلم Жыл бұрын
Very simple and very useful! Thanks ❤ 🇲🇦
@anonymspro7864
@anonymspro7864 3 жыл бұрын
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 2 жыл бұрын
Big thanks man. Really appreciate what you do.
@EBKCS_DHRUV_SHARMA
@EBKCS_DHRUV_SHARMA Жыл бұрын
man i love you, best is what i think you are!!!!
@yadobeatz359
@yadobeatz359 Жыл бұрын
very simle and helpful a lot, thank you a lot
@ChudiO
@ChudiO 5 ай бұрын
Really good tutorial, has helped improve my Python knowledge 😊
@svetlanadelrey973
@svetlanadelrey973 Жыл бұрын
i would love if u explained what are you doing in ur actions
@evoamer2686
@evoamer2686 Жыл бұрын
You have made me switch from C# to python my friend
@DC_Luxurious_Cars_
@DC_Luxurious_Cars_ Жыл бұрын
I really enjoyed this. Thank you very much.
@hemanmoriya8237
@hemanmoriya8237 11 ай бұрын
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 .
@walking-9182
@walking-9182 11 ай бұрын
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 11 ай бұрын
@@walking-9182 I used pycharm for python development
@patibandlalatha7530
@patibandlalatha7530 Жыл бұрын
Very much helpful to the python learners
@affenkratzer
@affenkratzer 11 ай бұрын
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
@Veestar4u
@Veestar4u 11 ай бұрын
Thank you so much.
@walking-9182
@walking-9182 11 ай бұрын
thank buddy 🙏
@Veestar4u
@Veestar4u 11 ай бұрын
Can you please explain why he .delete came before the .insert?
@affenkratzer
@affenkratzer 11 ай бұрын
@@Veestar4u because of the grid placement you need to change it
@tortu_nashe
@tortu_nashe Жыл бұрын
nice vid liked n subed , made me feelike programming more
@aradthetyper2101
@aradthetyper2101 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?
@poorvinalavade8651
@poorvinalavade8651 2 жыл бұрын
even i want to know the meaning of those parameters
@timmyt1232
@timmyt1232 2 жыл бұрын
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
@Himlajchan 8 ай бұрын
@@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?
@kennethlourisombrog2149
@kennethlourisombrog2149 Жыл бұрын
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.
@LikinMB
@LikinMB Ай бұрын
Great explanation sir, but it would be better if there was "Clear entry" button which only clears the last number that is entered and I how can I implement that ?
@emitaylorb52
@emitaylorb52 5 ай бұрын
So wonderful
@maitruong7909
@maitruong7909 Жыл бұрын
Awesome! 10 points
@fayazshams-rd3ek
@fayazshams-rd3ek Жыл бұрын
Really really really Great i wish you more success ❤❤❤
@brendanjordan5485
@brendanjordan5485 2 жыл бұрын
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 Жыл бұрын
@@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 Жыл бұрын
thank you so much it works@@TheRealStrider
@theminecrafttree8913
@theminecrafttree8913 2 жыл бұрын
the best tutorial ever bro u da best
@dieelitezwerge7622
@dieelitezwerge7622 2 жыл бұрын
thanks for another very nice video😇😉
@rekhNZ
@rekhNZ 3 жыл бұрын
0:42 when he said nonsense haha
@exxavier1695
@exxavier1695 Жыл бұрын
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
@johnbishoppp
@johnbishoppp 3 ай бұрын
Why not make a class with attributes for the number, row and column, then make a function for creating the button and run it in a for loop. This is how I did it, to save time and not repeat code. I couldn't figure out how to make the loop also name the buttons incrementally (i.e. btn_1, then btn_2) so I had to type that manually. Also had to manually type out the code for equals and clear as the command was different to the others. Would love your thoughts.
@Tom-ks9xl
@Tom-ks9xl Жыл бұрын
What interface are you using? Looks very good. The standard IDE isn't as nice as this
@N7ShepardSR
@N7ShepardSR Жыл бұрын
PyCharm its really good
@Tom-ks9xl
@Tom-ks9xl Жыл бұрын
Thank you i found it and installed it right onto linux. It's a very nice interface and handy.
@riascho
@riascho Жыл бұрын
Interesting explanation on the eval() functionality. But what alternatives would you suggest for better security?
@GeovaniLopesDias
@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
@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
@v11r Жыл бұрын
You need to implement a tree
@paulmwangi270
@paulmwangi270 Жыл бұрын
The tutorial was topnotch
@YukiArtsandCrafts
@YukiArtsandCrafts Жыл бұрын
Interesting explanation ❤
@Al_X-2005
@Al_X-2005 Жыл бұрын
Now that I can make custom buttons I can finally create the Calculator 2
@zhangchill1616
@zhangchill1616 Жыл бұрын
Very simple Thank yous
@anirudhpm7155
@anirudhpm7155 Жыл бұрын
How can i add √ and on off button could you please help me.
@himanshuranjansingh6134
@himanshuranjansingh6134 3 жыл бұрын
Thank you man🌻
@pan_ching
@pan_ching 8 ай бұрын
How do you do the copy paste trick??? damn. It seems like it's a shortcut key or somethin' it was so quick ahahahhah
@feliperodrigues3277
@feliperodrigues3277 2 жыл бұрын
You're the best one to explain, ty so much man
@frigontech
@frigontech Жыл бұрын
20:24, do equals without the lambda
@y7365mVVHsK9J
@y7365mVVHsK9J 5 ай бұрын
Thanks bro 🧑‍💻🧑‍💻
@RahulKumar-cm1sy
@RahulKumar-cm1sy 9 ай бұрын
Thank you sir ❤
@wise_beanss
@wise_beanss Жыл бұрын
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)
@rezalapriani1001
@rezalapriani1001 3 жыл бұрын
i learn from your video, thanks you soo much
@anakin.gulliver
@anakin.gulliver 3 жыл бұрын
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 3 жыл бұрын
import tkinter
@akellner2
@akellner2 Жыл бұрын
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.
@Tom-ks9xl
@Tom-ks9xl Жыл бұрын
Fantastic
@housemajaliwa
@housemajaliwa Жыл бұрын
Good stuff
@p98976
@p98976 Жыл бұрын
this helped me so mauch thax
@ethan_haymore3907
@ethan_haymore3907 11 ай бұрын
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
@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
@caw986
@caw986 2 жыл бұрын
hi good video all in all but the code keeps on throwing the error message at me when i perform any calculations
@davidianmusic4869
@davidianmusic4869 Жыл бұрын
Thanks!
@BruceChangwe-yt9ce
@BruceChangwe-yt9ce Ай бұрын
plaese help I followed everything but when I press a number it's giving me a word calculation. what could be the error
@ayuzshh
@ayuzshh Жыл бұрын
so usefull and hepfull I subsribed this is my 2nd videio watching
@akshar088
@akshar088 11 ай бұрын
amazing
@noir66146
@noir66146 2 жыл бұрын
my kind of tutorial
@kalacarte
@kalacarte 2 жыл бұрын
for some reason line 19 isnt working ofr me at 3:43 through 3 :53
@yoonesaghtaii8991
@yoonesaghtaii8991 11 ай бұрын
thanks bro❤
@diegos2184
@diegos2184 5 ай бұрын
where did u learn to code?
@Void-Dev
@Void-Dev 2 жыл бұрын
For the buttons why not just use a definition?
@Knowmemelife
@Knowmemelife Жыл бұрын
Brow what will I do if on calculator I click 1 and the result is always calculation
@PCANDPOCO
@PCANDPOCO 9 ай бұрын
thank you very much
@gooddaywithme7986
@gooddaywithme7986 4 ай бұрын
thank you so much 😭😭😭😭🙏🙏🙏🙏
@iumamaiftikhar
@iumamaiftikhar Жыл бұрын
sir i have a problem on line 5 iwrote it correct what should i do
@alirezaahmadivand831
@alirezaahmadivand831 2 жыл бұрын
Thanks a lot 🙏
@Partha-q8h
@Partha-q8h 11 ай бұрын
Thanks
@Dalazyfilm
@Dalazyfilm 10 ай бұрын
Tysm❤❤😊
@sianbunny7724
@sianbunny7724 11 ай бұрын
thnx man 🙏
@mariustrelea5132
@mariustrelea5132 3 жыл бұрын
Can you implement it with constants e and π , and also trigonometric functions
@flowman8414
@flowman8414 3 жыл бұрын
well do try to do it yourself
@mariustrelea5132
@mariustrelea5132 3 жыл бұрын
@@flowman8414 import math has trigonometric functions and also the inverse functions of themselves ?
@flowman8414
@flowman8414 3 жыл бұрын
@@mariustrelea5132 yea i think so
@skitmc5842
@skitmc5842 11 ай бұрын
17:17 (just a marker so i can skip back into the video without losing where i was before)
@reskretny20
@reskretny20 Жыл бұрын
he looks like Nacho from Better call Saul
@HardeepSingh-ec4zq
@HardeepSingh-ec4zq 10 ай бұрын
How can I add percentage button in this program
@jokemiri
@jokemiri 2 жыл бұрын
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 Жыл бұрын
And also there should ve back space
@srshivam96
@srshivam96 3 ай бұрын
Not working now it says TypeError: 'float' object is not subscriptable whenever i press a button
@googlegoogle1610
@googlegoogle1610 3 жыл бұрын
i like your video but why not to paste the code in the description
Tkinter Beginner Course - Python GUI Development
38:59
NeuralNine
Рет қаралды 597 М.
Build this JS calculator in 15 minutes! 🖩
15:20
Bro Code
Рет қаралды 780 М.
Непосредственно Каха: сумка
0:53
К-Media
Рет қаралды 12 МЛН
"Идеальное" преступление
0:39
Кик Брейнс
Рет қаралды 1,4 МЛН
I'VE MADE A CUTE FLYING LOLLIPOP FOR MY KID #SHORTS
0:48
A Plus School
Рет қаралды 20 МЛН
Who is More Stupid? #tiktok #sigmagirl #funny
0:27
CRAZY GREAPA
Рет қаралды 10 МЛН
Build A Simple Calculator App - Python Tkinter GUI Tutorial #5
18:05
5 Good Python Habits
17:35
Indently
Рет қаралды 717 М.
Modern Graphical User Interfaces in Python
11:12
NeuralNine
Рет қаралды 1,6 МЛН
Python GUI Development With PySimpleGUI
15:15
Real Python
Рет қаралды 1 МЛН
25 nooby Python habits you need to ditch
9:12
mCoding
Рет қаралды 1,8 МЛН
Fast Inverse Square Root - A Quake III Algorithm
20:08
Nemean
Рет қаралды 5 МЛН
Android App Development in Python With Kivy
26:27
NeuralNine
Рет қаралды 299 М.
Transformers (how LLMs work) explained visually | DL5
27:14
3Blue1Brown
Рет қаралды 4,7 МЛН
Make Tkinter Look 10x Better in 5 Minutes (CustomTkinter)
4:40
TurbineThree
Рет қаралды 385 М.
3 PYTHON AUTOMATION PROJECTS FOR BEGINNERS
17:00
Internet Made Coder
Рет қаралды 1,7 МЛН
Непосредственно Каха: сумка
0:53
К-Media
Рет қаралды 12 МЛН