How to Create a Calculator in Python with Flet
Jun 20, 2025
Flet is a powerful Python framework that allows you to create modern and responsive graphical interfaces without the need for advanced front-end knowledge. Creating a Simple Calculator with Flet in Python 💖 Donate and help us create more amazing content! 🙌 Every contribution makes a difference! ☕ Buy me a coffee: https://buymeacoffee.com/usandopython 💖Support this channel https://www.youtube.com/channel/UCpL2Gru508Z39oPqu1FIg4Q/join ⚡️ Connect with me on: Instagram: https://www.instagram.com/pybeginners/ Twitter: https://x.com/joaofuti_ LinkedIn: https://www.linkedin.com/in/joao-futi-muanda-16b980175/ Website: https://www.usandopy.com/en/ Thread: https://www.threads.net/@pybeginners
View Video Transcript
0:00
hello guys welcome back to the channel my name is so today we're going to create a new project by using python flat okay so this this is a arithmetic
0:08
calculator okay so that can do some basic operations okay like uh division
0:14
multiplication addition and subra so this calculator is made by using Python and flat framework okay flat framework
0:21
is a framework in Python that can help you to create mobile app desktop app even web app by using python okay so if
0:28
you want to learn more about flat don't get I'll keep the link in the Des in the description of this video and for those
0:34
also want to get the full code of this project okay and I'll keep a link there
0:39
where you can go and get it the code the full code of this project so in order for us to create this project we are
0:45
going to do something like this here uh okay I'm going to put this thing aside and you need to create a new script in
0:52
Python so inside of this script we will start creating the thing okay so the first thing that we need to create is
0:57
the main okay the main extra of the project so for that I'm going to do something okay first here in my script I
1:04
need to import flat okay I'll do something like this import flat so then I have to create my view so
1:11
for that I'm going to create something like this death main okay I'm going to open and close so I will go page okay do
1:18
ft okay so here flat okay since I import flat like that okay I will consider it as ft okay so I'll do something like
1:24
this import flet as FD okay so every time we we want to use it okay so I'm
1:29
I'm just going to call ft so that's why here I'm calling ft so then it will be ft. page okay ft. page do okay I'm
1:39
coming inside so after this I'm going to do something like this okay page dot oh sorry page.
1:46
title okay and it will be equal okay I'm going to do this in calculator
1:53
calculator perfect so then after this okay so this page do TI okay I'm I'm
1:59
going to define the title of my app okay so because if you see this app here
2:05
there is a kind of a name here calculator okay so this is the title of my app so after this okay I'm going to
2:12
do I'm going to create okay so that so after this okay I need to run
2:19
this this function okay so for that in order to run this function I just need to do something like this okay ft dot do
2:26
app okay I'm going to open and close so I put something like this target okay will be equal main perfect so this
2:33
is the one okay uh this line of code is the one will help us so this line of the
2:39
code is then that is going to help us to call this function okay so that it can run and the show flat application so if
2:45
I save this and if I run let's see what what will be the
2:51
result so as you see okay it gave us the result which is this one okay but if we
2:57
see properly okay for here okay there is no this title which I Define here okay so in flat in order for us to show the
3:04
title here we need to first update our main page okay so for that I can do something like this okay page dot update
3:13
okay page. update open and close I'm going to close this then let me run it again and boom as you can see now I have
3:22
this one okay this calculator there is the name Okay calculator perfect
3:30
so now okay since we have this thing here okay now we are going to start to create our UI okay for this calculator
3:38
so this is the one that we are creating this is the main one so the first thing that we are going to do first let's define the background color for this app
3:45
okay because we can see this one as a back background color like full black okay dark color and even the width also
3:53
we need to Define because this one if I come here as you can see okay I can change the WID okay it's very responsive
4:00
okay I can do like this even if I open like full mode okay it's still working so I need to define those things uh for
4:07
this same up and even the padding okay so for that I'm going to do something like this let me hide this one and close
4:14
this guy then I will come here inside I'm going to do something like this okay page dot back background color Okay BG color
4:23
Okay page do B color will be equal okay I'm going to do a string okay so the
4:28
color that I'm going to use will be this one okay Cardinal 2D 2D and 2D this way
4:34
okay save and after that I'm going to Define also the width and the height for the page so for that I'm going to do
4:41
page. window okay page. window. WID okay
4:47
H will be equal 350 okay perfect then I'm going to do the same thing for height okay page dot
4:56
window okay window. height okay it will be equal okay I'm going to
5:04
Define like 470 perfect then I'm going to do something else also which is very good okay page do
5:10
pading okay page do pading is going to be equal 10 perfect then I'm going to
5:16
save and if I run this and boom as you can see now we have
5:21
this thing here okay so but it's too large okay so now let me decrease a little bit so instead of four I'm going
5:28
to give like a 300 okay save and run okay still big uh maybe 200 will be
5:36
good 200 save and run okay I think I this is still big because of uh this pading that I'm going
5:44
I'm giving here okay so but don't worry once we'll start putting things inside of this of this okay this uh width
5:52
inside of this page okay so then it will start changing so for now let's just skip like this okay so the next thing
5:58
that I'm going to do will be the following so this one I'm just going to
6:03
keep it as a 470 again so if we check here the principal
6:11
to so now the next thing that we need to do is this one okay we need to create this display so that we can show the
6:17
results so in order to create this display we just have to do something like this okay I'm going to come here
6:22
give a little space then I will create something like this okay when you create a variable called display okay this
6:27
display will be equal ft okay I'm going to put this display inside of a container so will be ft. container ft.
6:36
container I'm going to open and close do like this then I will do something like this okay content for this contenter
6:42
okay content will be equal okay so this content okay before I give it something
6:48
okay I'm going to create a test W widget okay so this test test widget is the one
6:54
that I'm going to give inside of this content for display so for that I'm going to do something like this I'm
6:59
going to get a variable called result okay result test so this result test is
7:04
the variable that will show us the result okay in our screen so for that I'm going to create it like ft. test I'm
7:12
going to open and close then I will say I'll give it value okay what will be the value so the value initially I want it
7:19
to be zero okay I'm going to give zero comma then I'm going to define a size
7:24
for it okay size will be equal 28 comma and apart of size okay I'm going
7:30
to give also the color of the letter that I want so the color will be white so color will be equal uh do like this
7:38
then just write white and I'm going to define the test align so the text align
7:45
okay text align will be equal okay I'm going to align everything in the right
7:50
side okay right perfect so then the next thing that I'm going to do okay I'm
7:56
going to take this result okay I'm going to copy it and I will pass it in my display content okay so I'm going to
8:03
give it boom like this so after that I'm going to keep it
8:08
comma okay so now inside of this content okay before I do anything I'm just going
8:13
to save this and if I run this thing let me see as you can see nothing showing
8:20
okay so in order to show all those things that I just made this change I have to let me close this and I will
8:26
create a column okay a column that I will be adding everything that I just did so for that I don't need this thing
8:33
anymore okay since I'm going to do something like this C page okay do
8:39
add open and close Okay what I'm going to add here I'm going to add a column
8:44
okay so I'm going to create ft dot column so inside of this column is where
8:52
I will keep uh inserting everything okay so then I need to give as a list okay
8:58
because colum take the things as a list then after here I'm going to give a comma here okay
9:04
perfect so now the first thing that I'm going to give inside of this column I need to give this display so that it can
9:10
show inside of our page so for that I'm going to give display okay comma save
9:16
then after this okay I'm going to run to see what I have okay run this
9:21
code boom as you can see okay now I have my display here okay it's like zero but
9:27
in order to organize this properly okay so that it can show like this one okay
9:33
so that it can show like this one so I have to do something like this see let's do some definition okay some configuration inside of this display
9:40
container okay so inside of this display container let's do something like this okay after
9:46
this comma result okay I'm going to define the BJ color okay the background color will be equal okay I'm going to
9:52
this so the color that I'm going to use will be this one okay Cardinal 37 okay
9:58
uh 7 47 and 4 F this is the color that I'm
10:04
going to use then comma so after that I'm going to Define define also a ping for it okay ping will be equal 10 and
10:12
then also I'm going to define something like this okay the borders so I want it to be kind of a circle so I'm going to
10:18
do B the radius all the radius will be equal 10 also comma and the height okay
10:26
the height for it will be equal [Music]
10:34
uh will be equal 70
10:40
okay will be equal 70 comma and I'm going to Define also the alignment okay
10:47
alignment so alignment will be equal ft do alignment
10:53
alignment okay dot Center underscore right
11:00
perfect okay save now if I run this guy let me run to see what we have okay I got some kind of error as we
11:09
can see so I think it's because of this as see it's showing here so got an asp
11:15
keyword height so this is wrong okay the way that I gave so just let me check it
11:20
uh where is height okay so I wrote it wrong so first is H
11:28
then is T okay HD this way save and if I run this again boom as you can see now we have
11:36
the display okay perfect so now after this okay the next thing that I'm going to do will be something like this
11:43
see okay so now we need to add some bottoms okay say those bottoms here okay
11:49
so for that let's do something like this and here below the display okay I'm
11:54
going to do some stuff okay so I'm going to create a a variable called Buton grid okay Buton
12:03
okay bonor GD bmore grid it will be equal a list
12:10
okay so all those buttons are put it inside of a list okay so that we can uh
12:17
so that we can okay organize the things properly so here inside of this grid list okay so I'm going to do something
12:22
like this okay I'm going to open another list okay do like this so
12:29
now inside of this list okay I'm going to give the first row that I have here
12:34
okay see this first row here will be inside of one list this also will be inside of one list this this and all of
12:40
them will be inside of one list okay so for that I'm going to do something like this okay I will open a tuple then I'm
12:46
going to give it comma here so inside of this Tuple the first thing that I'm going to give there will be something
12:52
like this okay it will be C okay I'm put C C is for Clear okay then after c okay
12:59
I'm going to give also another one which will be sorry it must be a tuple okay it
13:05
will be um the percentage operation okay then the after the percentage operation
13:11
never forget to put comma okay after that okay I'm going to give another one which is division okay let's use comma
13:19
after the division the next one will be okay and it's going to be start okay for
13:26
multiplication comma and save okay so
13:32
this list okay uh will be the first row okay which will be a list of two BS so then I'm going to come here comma so now
13:39
see as you can see see now we have this one okay so in order to have this one okay we'll be doing the same thing also
13:45
let me uh do this and just going to copy this thing okay I'll copy it come here
13:52
do like this and past okay I'm going to do again past I'm going to give again
13:58
and past so how many I have 1 2 three 4 okay uh let me see how many rows I
14:05
have here 1 two 3 four five so I need five okay so I'm going to paste again
14:11
last one and boom perfect so now I the the only thing that I need to do is just
14:16
to to change okay so this one will be seven
14:21
8 okay 78 after 8 it will be nine then after
14:27
nine it will be sub ation okay so after that the next one will be
14:33
four uh this must be five and this will be uh
14:40
six and this one I'm going to give it as a plus okay boom
14:45
perfect so now the next thing that we need to do is something like this okay
14:50
so here I'm going to give one this one I'm going to give two and this is
14:57
three so the last one will be equal okay this is the equal so this is going to be
15:06
zero and this one is going to be do
15:11
okay and the last one will be this one for deleting stuffs okay for deleting
15:17
stuff I'm going to give okay so I'm going to give something like this oh I just run by mistake something like this
15:23
okay and then in the here if we check in the original one okay here we don't we have only three okay so that means I'm
15:29
going to remove this guy okay byebye and select this one perfect
15:35
safe okay so in order to show those bottoms
15:40
okay inside of our page so we need am going to do something like this see okay
15:46
uh but even this last one I can remove this comma no problem okay so I'm just going to do something like this okay I'm
15:52
going to come here down itself okay give a little space then uh I'm going to create the bottoms itself okay so first
15:59
thing I'm going to create a variable called buttons okay create okay not
16:04
create okay I'm going to create a varable called Buton okay butons so these butons will be equal a list a
16:11
empty list okay then after that I'm going to create a for Loop that will go through all of this list here that I
16:19
have this uh Buton Buton grid okay so let me add one in okay bottom grid so
16:25
for that I'm going to come down okay then I'll do something like this
16:31
see and down then I'll do okay for Row in bom grid okay in bom grid okay
16:42
dot perfect then I'm going to do something like okay I'm going to create a variable called like row control row
16:49
control okay so this row controls will be a empty list also okay and because
16:56
this really like two Dimension list something like this okay then I'm going to do something that again for test okay
17:01
because I need to get each value from each row so for test okay in for test in
17:09
row okay because I need to get this those test okay for test in row is going to do something like this okay let me do
17:15
then I'm going to create a BTN a Buton okay so this Buton will be equal ft okay
17:21
so this Buton will be the Buton itself okay then I'm going to create an elevated Buton elevated butom ele Buton
17:30
okay which will be equal okay which will open okay the first thing that I need to do is the test okay so the test will be
17:37
equal the test itself sorry the test which this test okay which each test
17:42
that we be having here okay so that's the one that we are giving here that we are pressing comma
17:48
then okay uh after that okay I'm going to create a variable called style okay
17:55
so this is style okay not a variable so I'm going to give it style to it okay so this style will be equal and ft okay dot
18:05
butons okay do butons Buton style okay so this is so
18:10
that I can style my botm okay botm style open and close I'm going to do this something like this okay then I'm going
18:16
to give a shape for it okay shape will be equal ft dot rounded okay
18:24
rounded rectangle rectangle okay rounded rectangle bar border okay open and close Okay then
18:33
here I'm going to give a radius for it okay so radius will be equal
18:40
five okay then just give me comma okay and after this I'm going to give Al a
18:45
ping okay ping will be equal zero perfect stay like
18:53
this so okay this one let me put it down okay I think this way is better it's more
18:59
after create this botom okay inside of this Row for each each value that will be inside of the list okay then I'm
19:05
going to do something like this okay I'm going to come out okay and I'm going to do something this okay row okay because
19:12
we need to append this row okay so then it will be row control do append okay
19:18
what I'm going to append do append append what BTN okay those buttons save
19:24
so after that okay I need now I need to do something like this okay go a little to the back in the some line with this
19:31
the it's this for which inside of the main for for row okay for Loop not for
19:36
okay then it will be butons okay because now I need to send this thing inside of that botom list then it will be butons
19:43
okay dot dot what upend open and close oh I came to I'm
19:50
putting this wrong place okay Buton butons do
19:56
append okay do append what I'm going to I'm going to append ft do row okay
20:03
everything will be inside of one row only okay do row row must be capital okay both Row open and close but I'm
20:09
going to so I'm going to pend this row here okay because this one is the one which will be contain the value for one
20:15
row okay for one row second row third row something like that so go to row
20:20
okay I'm going to open that row controls okay comma so since this is a row okay
20:26
I'm going to give it space because I don't want everything to be like to girl so I'm going to give spacing okay
20:32
spacing okay will be equal five okay I'm going to save perfect so then after this okay let
20:39
me run to see if I have any error save and run okay I did well okay uh I got some
20:47
kind of error okay uh which is this one okay uh Buton style okay so I wrote it
20:56
badly so here is not buttons so this s the
21:02
first s must go okay just like this and save Run Okay as we can see it's not showing
21:10
okay so now in order to show those bottoms okay I just need to come here okay I need to come here okay I'm going
21:17
to do something like this inside of my page okay then I'm going to create a column okay ft
21:23
dot column okay will be equal what weal I'm going to send those bottom okay this
21:29
one okay butons comma I'm going to give spacing okay for each row okay spacing
21:36
will be equal five not for each row for bottom between spacing between bottom
21:42
and display okay save okay now if I run this thing
21:48
again boom as you can see now I have my bottoms here okay so those are my
21:53
buttons which I have okay so uh about
21:59
okay let's do something like this okay so let's give a little space let me come it down okay let's use like spacing okay
22:05
spacing for this column okay this column here the main column spacing will be equal
22:11
15 save and if I run this okay now it's good perfect so now
22:18
let's give some style to these bottoms okay so in order to give style for this botoms okay I'm going to come here in
22:25
the top of my botoms grids okay
22:31
so the first sty that I'm going to do okay first I'm going to give sty for the numbers okay so that's why I'm going to
22:36
this I'm going to do something okay I'm going to create a variable called number it's too close let me give it okay
22:44
number style okay number style will be equal open and close okay it will be a
22:51
list I'm going to give it as a list open and close what the first thing that I'm going to give is height okay
22:59
H will be height so height will be dots I'm going to give it
23:05
60 comma okay then I'm going to give give Al BG color okay the BG color BG
23:12
color background color dot so for background color I'm going to give uh
23:18
this 4 d 4 d 4D okay save and the
23:23
comma so I'm going to give also the color for the letters okay color will equal
23:30
dot so it will be like uh White okay for the color I want white color oh mistake
23:39
white okay comma then I'm going to expand it okay like to give a little
23:47
span so expand will be only one is enough okay one and comma perfect save
23:54
so now H in order to give that style okay
24:00
and I'm just going to come me number style okay I'll copy this variable and
24:06
whatever there is a number okay I'm going to pass that one okay H inside for
24:11
example I'm going to come here where is the seven okay I'm going to give a comma
24:16
give a number this also a comma give number here also comma give it h where
24:24
is the number and there's the number okay comma
24:33
comma another number oh sh I think I run it no problem another number
24:40
comma here also comma and zero is also a number okay
24:47
comma so this will be the style for those numbers okay so then after that
24:53
okay now I'm going to do the same thing as for operators okay so I'm just going
24:58
to copy everything here okay give a little space and paste so now I'm going
25:03
to change this okay I'll be right like operators
25:08
operators operator style so in this operator style okay
25:14
everything will be the way that it is okay I'm just make going to make some change okay for from here oh I think see
25:21
I did a mistake here in this BJ color I forgot to give Cardinal okay Ash something like that Ash so here also let
25:28
me give Ash okay and perfect so now let's change this color here okay for the operator
25:35
style okay so this will be like a go bye-bye then let's use f f capital F
25:42
okay 95 and 0 0 perfect then this also will be white and the same thing now
25:48
let's copy this guy and where is that where is wherever there is a operator let's change it okay this is operator
25:56
okay oh no this guy is not operator uh
26:02
operator are those this is operator this is operator this is operator comma control V and which one more this guy's
26:09
operator comma control V this is operator and equal no equal
26:17
won't be operator okay it is to execute execute perfect so this gu is Al let's consider
26:25
it as operator okay save so uh now the next thing that we need to
26:32
do uh let's create another one for this one okay style for the C
26:40
okay so for that c is a clear okay so for that let's just copy this guy okay let's copy this operator style copy and
26:49
come here and paste okay so now for that it's
26:54
let's call it as a clear style okay clear style so for Clear style let's
27:00
keep this and here instead of uh this one let's delete this let's keep FF 3 B
27:08
okay 30 save and it will be something like this itself let's copy this style and
27:14
come here in the C comma and paste okay so that is for clear so now
27:21
let's create Al for equal also let me copy this guy come here save okay so for equal let's do
27:29
something like this okay and let's change the color okay let's change the
27:34
color it will be Cardinal 34 Okay C
27:41
75 9 perfect so it let's keep it white so let's change the name to
27:48
equal equals okay equal style so for the equal style let's copy
27:55
it go back to the equal where is equal yeah it is it comma and paste perfect
28:03
so after this okay uh this guy is missing okay that dot okay so but dot
28:12
dot will be number Al okay number style for DOT okay I'm just going to copy
28:17
number style come to dot okay give a comma and
28:22
paste it okay but if we see here okay in this app for uh this guy it expand for
28:30
two rows okay sorry for two columns there's number zero so for that let's do something here okay let's come here in
28:35
the zero and come here okay after this style okay let's give a comma and let's
28:41
do something like this okay so but first let's come here behind the style and let's do something like this okay so
28:48
this will be kind of let's put it inside like like a uh like I forget the this
28:56
okay so let's come here and give something like this as a this okay
29:01
boom okay so now let's do something like this oh this this guy
29:08
byebye like from up to here okay so number okay behind the number in order for us to to make some change okay put
29:16
start start okay then use comma okay and here let's change the expand okay so
29:23
let's change expand so expand now will be Dot and two okay let's give two to it
29:31
two so we we want it to occupy two columns
29:37
perfect so since now everything has is own style okay now in order to add this
29:44
we just need to come here inside of our for Loop so here where we have a test okay let's give something like this okay
29:49
comma now let's give something like called style okay so here in the style
29:55
okay we need to come here so we need to come here okay after test
30:02
okay let me give some enter then just put something like this okay St H start
30:08
start okay then just write style okay comma something like this okay now save
30:15
if we run this thing boom as you can see now every
30:20
style was applied into every bottoms okay so now we have the style perfect
30:29
so very well now the next thing that we need to give okay to do since now we have everything working perfectly okay
30:35
we have the UI okay is already done so the next thing that we need to do is to
30:41
end to get the values that when we click any botom okay so for that let's do something like this okay I'm going to
30:47
come here inside of okay and above the result test okay I'm going to create a variable called all values okay
30:54
lore values all underscore values will be equal a empty string okay so this all
31:02
values okay is where when we click any bottom okay everything will be like will be saving here okay will be added here
31:09
then in the end we'll send it into the eval eval oper uh function so that it
31:15
can Evol and do the operation okay the required operation so that's why we create this variable okay so after this
31:23
okay let's create the function to which will allow us to enter the numbers of for that let's create a function called
31:29
def oh super wrong okay def entering value entering entering okay Enter
31:36
underscore values okay open and close so this enter values will need one even so
31:42
that's why let's give e there and after this let's do something like this okay let's consider that all values as a
31:47
nonlocal non local non local do this all
31:53
values perfect then let's do something this okay all values okay will be plus
32:00
equal equal what equal a string okay so we call string oh is string string of
32:07
what a string of e dot control control okay dot text okay
32:16
control text so inside of the control inside of the control it will get the test okay inside of the bom perfect so
32:23
now let's do something this okay result for go when we get the the value okay we need to show it in the screen so for
32:30
that let's get this variable okay which has the test value test okay which which
32:35
would shows the test so that is result doore test dot value okay we need to
32:41
change the prop property of the value which this one okay you need to change this value so for that will be equal
32:46
equal what L values because everything whatever we press will be saved here inside of this variable so that's why we
32:53
put is equal all values okay dot so when we do any change we know that in flat we
32:58
need to update our page so for that let's update the page page do update okay so that it can show the result
33:05
update open and close and save perfect so now we need to connect this function
33:12
with the V with the bottom okay so to do that okay we have to come
33:19
here okay we have to come inside of those bottoms okay let's give some comma
33:25
okay uh comma here even this one comma so let's give here okay entering value
33:32
entering value this also comma entering value comma enter value this also
33:41
comma comma comma and comma this also and comma
33:48
let's put everything entering value entering value enter value enter value
33:55
okay for those ones also
34:12
comma and boom okay perfect so now we have everything here okay so in order
34:18
for that entering value function work okay now we need to come here inside of
34:23
this for Loop okay where we have test style let's add one more thing okay let's do
34:28
okay give a little space okay what we are going to give so let's call it as handle okay handle
34:35
Handler Handler okay so this Handler okay here inside of our botom let's come
34:42
here after test okay let's give something on click okay onore
34:48
click on click when we click the bottom okay so it will execute the Handler
34:54
function okay we execute Handler then use it let put it comma and
34:59
save Okay then if we run this guy okay this is the our function okay
35:08
this is our result so let's do if I click on seven boom I got some error okay so let's see the error which I got
35:15
what he said name error s ah SRT sorry it's supposed to be STL I think it is
35:22
here okay I'm not wrong it's here yes it's here okay s Str okay it's
35:28
supposed to be string s save okay let's run it
35:34
again okay perfect I have here okay so seven okay now as you can say enter the
35:39
numbers eight bar this this and this so now everything is entering okay perfect
35:45
now we want okay when we enter something okay we want also option to delete the
35:50
things so in order for that let's create another function which can help us to clear all those stuff okay so for that
35:59
let's do something like this see and I'm going to come here okay below the entering function I'm going to create
36:05
another function called f clear clear what clear screen clear screen okay open
36:13
and close e okay dot then let's me something okay let's consider as a non local what the
36:21
all values okay and let's say now all values since we want to clear okay it just a matter of us to change the all
36:28
values into empty string okay empty string so when we do that okay now we need to change also the result test okay
36:35
we need to change the value test do value do value
36:43
okay will be equal empty not empty will be equal zero okay will be equal zero
36:50
zero string okay and then we need to update the page so page do update open
36:57
and close save now if we run this guy again okay uh we need to connect it with
37:04
this bottom here okay with this bottom when we click it need to clear not entering the value so for that it's easy
37:12
we just need to come here okay let's copy it clear screen copy and let's go for that bottom where H this is the C
37:20
okay let remove entering value here and give it that clear screen so now if we
37:28
save this and if we run it again let's check okay uh eight blah blah blah blah
37:35
okay if I click in this one it clear okay whatever I now if I click here and
37:40
see it will clear the things okay perfect so now we want to when we enter the values okay for 59 plus 6 now I need
37:50
to click here so that you need to execute okay to show the result not entering this equal signal okay signal
37:56
so for that we need to here again okay and it can be here after this
38:02
function okay go back and let's let's create a function that will execute the things okay so for that let's do
38:09
something okay going to create a function okay the F this one I'm going to call it as a calculate okay
38:16
calculate calculate okay it needs one event okay dot and it will be something
38:22
like this as always first non local all values okay enter then let's use try
38:29
exception okay try dot try what try result result test do value because this
38:36
where we want to show the the result okay will be equal St okay open and
38:42
close let's use of Evol okay what we are going to evaluate we are going to evaluate all the values okay whatever
38:49
values is will be inside okay whatever character that will inside of this varable values we need to evaluate it
38:57
okay perfect so then after that okay we need to change go we change L values
39:03
will be equal the result okay result test dot value
39:09
perfect then in case if this thing fail let's say except accept accept what except result
39:18
test dot value okay will be equal okay
39:24
will be equal error in case it f okay equal arrrow then we need to empty the
39:30
all values okay all values will be equal empty string and save okay after that we
39:37
need to update the page so that it can show the change okay let's say page dot
39:43
update okay open and close perfect save now if I run
39:48
this oh nothing will happen because I forgot to connect it with this equal so
39:53
for that let's copy this calculator okay so now we need to go to the equal okay
40:00
bottom and connect them so where is the equal botm equal bottom is it okay
40:07
instead of entering let me delete it let's just paste the calculator okay save and run
40:14
this perfect now this is my calculator now let's change let's
40:20
check 7 - 9 equal - 2 is working okay
40:26
delete boom perfect 8 IDE 9 equal
40:31
perfect clear okay uh 552 module 9 equal 7 perfect and 7 / by
40:41
1 equal 70 perfect boom and 9 * 4 = 36
40:48
so now as you can see now our calculator is working okay so guys we will stay here okay as you can see our program is
40:54
working okay please subscribe to the channel give a like if you like like it and also please support the channel if
40:59
you can okay so that this can motivate more to create stuff so my name is see you in the next video okay bye-bye
#Computer Education
#Programming
#Scripting Languages

