Calculator Addition Function - Python Kivy GUI Tutorial #16

preview_player
Показать описание
In this video we'll build out the addition functionality for our calculator with Kivy and Python.

In the last video, we built out the basic GUI for our calculator app. In this video we'll add in some functionality.

First, we'll write code to deal with pressing number buttons and entering them into the text box at the top of our calculator.

Then we'll work on the math buttons (plus, minus, multiplication, and division).

After that we'll start to work on the equal button, but only for addition.
Рекомендации по теме
Комментарии
Автор

▶️ Watch Entire Kivy Playlist ✅ Subscribe To My YouTube Channel:
▶️ See More At: ✅ Join My Facebook Group:
▶️ Get The Code

Codemycom
Автор

I kept screaming use the eval()...😂😂 Thanks for the effort

nriezedichisom
Автор

Thanks for that... Actually I was able to complete that project before that video.... But I just completed it only for your nice teaching... Thank you

SammarpanDasguptaOfficial
Автор

As Always Awesome Person and Awesome Teaching Congratulations Please Keep it up

alaahoussen
Автор

Thank you so much, Man! You are The Best Teacher!😊 Great KivyMD Python tutorial for all!

Sv_Otec
Автор

13:06 I just used result = eval(prior) with a try and two expect with zero devision and error

xlayer
Автор

Thank you, Best teacher ever! haha, My all-time favorite part 0:00 0:20 0:34 , At that moment I be like :)

hg_ofthecity_old_thi
Автор

I enjoyed this video and it was useful, but you could have just had passed the "+", "-", "*", and "\" operators into the button press function. Also you could have used self.ids.calc_input.text += f'{button}' instead of self.ids.calc_input.text = f'{prior}{button}. Edit: Also use eval.

bradydeboer
Автор

Thanks for this video series. I love it. But I have an easier solution. There is a python built-in function for this. The eval() function. It supports every basic math calculations included "(", ")" and it can also deal with more than 2 numbers in the same time. Anyway... thanks for your videos, helped a lot.

tibssy
Автор

No special Cyber Monday code? I saw your deal last year, and have been waiting for a couple of months to see if there would be one this year. I know that what you are offering is worth much more, especially with your regular YouTube discount code, but you can't blame a guy for being a cheapsk.... er... thrifty. :) I really admire your business plan/implementation. Thanks for sharing your knowledge.

ideasinprogress
Автор

Perhaps this idea could simplify the code:
formula = "1+2/3"
print(f'{eval(formula)}')

CesarVerdes
Автор

In the kv file we placed a number inside the parentheses for each number button for the on press function, but as soon as I click python throws an error and the application quits despite copying your code exactly. So why this does not work?

hbarudi
Автор

Suppose you want to build a serious gui application say pdf viewer or any other application and you know tkinter, kivy, pyqt, qt, wxwidgets and electron. What would you use?Also which is your all round favourite gui framework/library ?

adityakomawar
Автор

Hi, how could i change the output color, i tried putting color: 1, 1, 1, 1 under TextInput: in the kv file but it doesnt change anything....

GobblingGlizzys
Автор

When I press '=', it doesn't calculate anything, the calculator stays the same, waiting for other actions... I begin to press other buttons and press '=' again, and it gives me the mistake "ValueError: invalid literal for int() with base 10: '5-9*5'" ... Why?

lusienda
Автор

HELP please...how would one define a boolean function in the py file and call it as root.funcname when the '=' button is pressed? I tried def __init__(self): and then store the bool value of the variable but this results in segmentation error. what's the correct way to define it? thanks in advance. I am new to kivy but going thru every kivy video that you have posted on YoutTube. Great tutorials! Much thanks.

koollucian
Автор

Plz tell how to download your code? Instead of copying it...

upprrdimensions
Автор

Thanks for the tutorials they're great!
Can't you just say in your if statement name = f'{button}' instead of self.ids.calc_input.text

MagicByIzzy
Автор

exec(_kvlang_.co_value, idmap)

File "c:\Users\hamza\Desktop\learn\name.kv", line 5, in <module>on_press: root.button_press(1)

File "kivy\\weakproxy.pyx", line 32, in 'BoxLayout' object has no attribute 'button press'
Plz help me

dm_saj