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

  • @wko_
    @wko_3 жыл бұрын

    Very simple and very useful! Thanks for one more project like this!

  • @BrendanBurkartSF
    @BrendanBurkartSF11 ай бұрын

    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!

  • @thatgarryman9400
    @thatgarryman94006 ай бұрын

    Literally explained better than half of the programmers in KZread. Makes sense, explains, doesn't do unnecessary stuff.

  • @efogovirtual9635
    @efogovirtual963511 ай бұрын

    I appreciate you, this is absolutely useful, nice tutorial

  • @arnavmeena525
    @arnavmeena5253 жыл бұрын

    NeuralNine: *Making Calculator and is doing calculations on it* Also NeuralNine: Am gonna do the calculations myself. Who needs a calculator?

  • @DC_Luxurious_Cars_
    @DC_Luxurious_Cars_11 ай бұрын

    I really enjoyed this. Thank you very much.

  • @yadobeatz359
    @yadobeatz359 Жыл бұрын

    very simle and helpful a lot, thank you a lot

  • @deeparose2926
    @deeparose29263 жыл бұрын

    Loved it!!

  • @nipoteemus2472
    @nipoteemus24722 жыл бұрын

    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!

  • @cannafarmer
    @cannafarmer2 жыл бұрын

    Thank you for the videos I like to scan them quick when i'm stuck

  • @AbubakarMulla23
    @AbubakarMulla233 жыл бұрын

    Love your coding bro... Stay going on..

  • @tomasg101
    @tomasg101 Жыл бұрын

    Thank you dude, I´m learning Python and this was perfect to achieve new knowledge Greetins from Argentina

  • @bonyimakaveli633
    @bonyimakaveli633 Жыл бұрын

    Big thanks man. Really appreciate what you do.

  • @anonymspro7864
    @anonymspro78643 жыл бұрын

    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 :) :) :) :) ;) ;)

  • @rodinicen689
    @rodinicen6894 ай бұрын

    Very nice video! More of this! :D

  • @exxavier1695
    @exxavier16959 ай бұрын

    I love the project it was very useful and helpful thanks

  • @user-mz9ql7oc9j
    @user-mz9ql7oc9j Жыл бұрын

    Very simple and very useful! Thanks ❤ 🇲🇦

  • @haokaixuan
    @haokaixuan3 жыл бұрын

    love these projects!

  • @tortu_nashe
    @tortu_nashe10 ай бұрын

    nice vid liked n subed , made me feelike programming more

  • @scratchersdotcom9336
    @scratchersdotcom9336 Жыл бұрын

    Very nice tutorial. I very well understood. Really appreciate it 👏

  • @himanshuranjansingh6134
    @himanshuranjansingh61343 жыл бұрын

    Thank you man🌻

  • @theminecrafttree8913
    @theminecrafttree89132 жыл бұрын

    the best tutorial ever bro u da best

  • @user-wv1kr2pz1q
    @user-wv1kr2pz1q Жыл бұрын

    Interesting explanation ❤

  • @dieelitezwerge7622
    @dieelitezwerge7622 Жыл бұрын

    thanks for another very nice video😇😉

  • @rezalapriani1001
    @rezalapriani10012 жыл бұрын

    i learn from your video, thanks you soo much

  • @100mikedaniel6
    @100mikedaniel63 жыл бұрын

    Stay on the upload grind!

  • @NeuralNine

    @NeuralNine

    3 жыл бұрын

    one video every other day! 💪🏻

  • @AlexMuseMatrix

    @AlexMuseMatrix

    3 ай бұрын

    Try 4 videos Every day, It's a great schedule 😎@@NeuralNine

  • @EBKCS_DHRUV_SHARMA
    @EBKCS_DHRUV_SHARMA11 ай бұрын

    man i love you, best is what i think you are!!!!

  • @tsmghost
    @tsmghost3 жыл бұрын

    Already made that but still learnt something new❤️❤️❤️

  • @theminecrafttree8913

    @theminecrafttree8913

    2 жыл бұрын

    nice flex

  • @rushikeshmali3057
    @rushikeshmali30572 ай бұрын

    Thanks for beautiful guidens

  • @fayazshams-rd3ek
    @fayazshams-rd3ek Жыл бұрын

    Really really really Great i wish you more success ❤❤❤

  • @sarveshsargunan4914
    @sarveshsargunan4914 Жыл бұрын

    i learned a lot from this video and i did it myself as well

  • @arslanuzakov988
    @arslanuzakov988 Жыл бұрын

    i really like that thats the first youtube project thats works without error, thank you sir

  • @Lejo1_LV

    @Lejo1_LV

    Ай бұрын

    now i can not agree it dosent wor to me

  • @zhangchill1616
    @zhangchill16168 ай бұрын

    Very simple Thank yous

  • @patibandlalatha7530
    @patibandlalatha75307 ай бұрын

    Very much helpful to the python learners

  • @KatherineHunt-bz9fg
    @KatherineHunt-bz9fg6 ай бұрын

    Learning python on a calculator

  • @abhinavgangwar4690

    @abhinavgangwar4690

    Ай бұрын

    Thats a classic chad move

  • @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.

  • @piklif5278
    @piklif5278 Жыл бұрын

    this helped me so mauch thax

  • @akellner2
    @akellner28 ай бұрын

    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.

  • @maitruong7909
    @maitruong79097 ай бұрын

    Awesome! 10 points

  • @kennethlourisombrog2149
    @kennethlourisombrog21496 ай бұрын

    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.

  • @lerserk
    @lerserk Жыл бұрын

    19:46 Its the lambda bro!! Thank you for this!

  • @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)

  • @Victory-py7lp
    @Victory-py7lp4 ай бұрын

    Can someone explain why he uses the .delete first before the .insert? What does that do?

  • @alirezaahmadivand831
    @alirezaahmadivand8312 жыл бұрын

    Thanks a lot 🙏

  • @RahulKumar-cm1sy
    @RahulKumar-cm1sy2 ай бұрын

    Thank you sir ❤

  • @feliperodrigues3277
    @feliperodrigues3277 Жыл бұрын

    You're the best one to explain, ty so much man

  • @PCANDPOCO
    @PCANDPOCO2 ай бұрын

    thank you very much

  • @anirudhpm7155
    @anirudhpm7155 Жыл бұрын

    How can i add √ and on off button could you please help me.

  • @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

  • @Tom-ks9xl
    @Tom-ks9xl6 ай бұрын

    Fantastic

  • @ethan_haymore3907
    @ethan_haymore39073 ай бұрын

    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

  • @davidianmusic4869
    @davidianmusic48699 ай бұрын

    Thanks!

  • @housemajaliwa
    @housemajaliwa Жыл бұрын

    Good stuff

  • @caw986
    @caw986 Жыл бұрын

    hi good video all in all but the code keeps on throwing the error message at me when i perform any calculations

  • @yoonesaghtaii8991
    @yoonesaghtaii89914 ай бұрын

    thanks bro❤

  • @Void-Dev
    @Void-Dev Жыл бұрын

    For the buttons why not just use a definition?

  • @evoamer2686
    @evoamer26865 ай бұрын

    You have made me switch from C# to python my friend

  • @iumamaiftikhar
    @iumamaiftikhar Жыл бұрын

    sir i have a problem on line 5 iwrote it correct what should i do

  • @sianbunny7724
    @sianbunny77244 ай бұрын

    thnx man 🙏

  • @paulmwangi270
    @paulmwangi270 Жыл бұрын

    The tutorial was topnotch

  • @fzel1
    @fzel15 ай бұрын

    the amount of time he takes to build the calculator is so impressive

  • @svetlanadelrey973
    @svetlanadelrey9737 ай бұрын

    i would love if u explained what are you doing in ur actions

  • @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

  • @flowereye3720
    @flowereye37202 жыл бұрын

    Thank you

  • @tummatantewadonprasit639
    @tummatantewadonprasit6393 ай бұрын

    Tysm❤❤😊

  • @akshar088
    @akshar0884 ай бұрын

    amazing

  • @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

    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

    @oadeep

    9 ай бұрын

    thank you so much it works@@TheRealStrider

  • @surfineer
    @surfineer Жыл бұрын

    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

    9 ай бұрын

    You need to implement a tree

  • @HardeepSingh-ec4zq
    @HardeepSingh-ec4zq3 ай бұрын

    How can I add percentage button in this program

  • @user-qt4jh1lq6s
    @user-qt4jh1lq6s4 ай бұрын

    Thanks

  • @pan_ching
    @pan_chingАй бұрын

    How do you do the copy paste trick??? damn. It seems like it's a shortcut key or somethin' it was so quick ahahahhah

  • @noir66146
    @noir661462 жыл бұрын

    my kind of tutorial

  • @ernurernur303
    @ernurernur303 Жыл бұрын

    hey guys , how to add backspace function ? if you know pliss

  • @Knowmemelife
    @Knowmemelife8 ай бұрын

    Brow what will I do if on calculator I click 1 and the result is always calculation

  • @jasongonzalez502
    @jasongonzalez50222 күн бұрын

    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!

  • @nellcid7909
    @nellcid7909 Жыл бұрын

    how to fix "text_result" is not defined error?

  • @aradthetyper2101
    @aradthetyper21012 жыл бұрын

    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)

  • @Himlajchan

    @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?

  • @user-pm5bx5tg4g
    @user-pm5bx5tg4g4 ай бұрын

    After lambda add to command is not showing in blue colour

  • @dedehurairrah4345
    @dedehurairrah43452 ай бұрын

    When i click the number are error, can you repair my code?

  • @anakin.gulliver
    @anakin.gulliver2 жыл бұрын

    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

  • @leadgebrat9880
    @leadgebrat9880 Жыл бұрын

    The delete function is not working... Gives an Attribute error

  • @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?

  • @unknown-cz5yh
    @unknown-cz5yh Жыл бұрын

    error is occuring when i am adding 1+1 how to solve this problem

  • @SnowNight
    @SnowNight Жыл бұрын

    intro music name?

  • @Al_X-2005
    @Al_X-20054 ай бұрын

    Now that I can make custom buttons I can finally create the Calculator 2

  • @Cheezou.
    @Cheezou.2 жыл бұрын

    Where is the code , i wanna compare with mine pls

  • @therumblemain
    @therumblemain10 ай бұрын

    so usefull and hepfull I subsribed this is my 2nd videio watching

  • @Tom-ks9xl
    @Tom-ks9xl5 ай бұрын

    What interface are you using? Looks very good. The standard IDE isn't as nice as this

  • @N7ShepardSR

    @N7ShepardSR

    5 ай бұрын

    PyCharm its really good

  • @Tom-ks9xl

    @Tom-ks9xl

    5 ай бұрын

    Thank you i found it and installed it right onto linux. It's a very nice interface and handy.

  • @soufatldude700
    @soufatldude7003 ай бұрын

    do you need pycharm for this, or can you use the normal python application?

  • @reaction_124

    @reaction_124

    Ай бұрын

    hi gojo kun

  • @soufatldude700

    @soufatldude700

    Ай бұрын

    @@reaction_124 Nah i'd win.

  • @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

    9 ай бұрын

    And also there should ve back space

  • @support_gaza
    @support_gaza Жыл бұрын

    How to delete one number?

  • @kalacarte
    @kalacarte Жыл бұрын

    for some reason line 19 isnt working ofr me at 3:43 through 3 :53

  • @reskretny20
    @reskretny207 ай бұрын

    he looks like Nacho from Better call Saul

  • @RekhsKitchen
    @RekhsKitchen2 жыл бұрын

    0:42 when he said nonsense haha

  • @googlegoogle1610
    @googlegoogle16102 жыл бұрын

    i like your video but why not to paste the code in the description

  • @mariustrelea5132
    @mariustrelea51323 жыл бұрын

    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

  • @Hunter-kd4gi
    @Hunter-kd4gi5 ай бұрын

    SyntaxError: expected 'except' or 'finally' block

  • @joemjencombs8202
    @joemjencombs8202 Жыл бұрын

    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

    @onemangamer587

    Жыл бұрын

    Are you using "*" or "x"? Because "x" will throw an error

  • @pro_gamer_mt7690
    @pro_gamer_mt76902 жыл бұрын

    It keeps showing tk not defined

  • @speedev
    @speedev3 жыл бұрын

    Thx.

  • @NeuralNine

    @NeuralNine

    3 жыл бұрын

    ^^

Келесі