Here everyone since the last video we have learned about creating a window in this video.
We will go for the first visit.
That is a button.
So here have my Adam and the terminal here with the extra battery.
So now first of all at minimum this one and no adding any widget is very simple.
You just need to create a variable declare digit and then just show that widget on the window.
That begins with creating a variable like B and you just need to add here the fidget name like button
for a button canvas for canvas frame for frame in which always the first trade is capital then you need
to pair past differences in which first you need to define that in which window you want.
This one.
Like if I found this one in my first window win.
Then just win here.
Then some text you want to show on your button say button you have this I know you tried to run this
one here.
You will get a running window but you would not get any button there.
There it is.
We do not have any button on the window.
That's because declaring a button is one but then showing the button is another.
This one is just like printing any text but here we will use back methods.
We had three methods here that is first one back then we have grid and then we have a last place.
So these methods are just like printed text but here they're printing division because they are performing
something so we cannot use a print here.
There is a video about these three in the last.
You can post that one but hey I will give you a basic introduction.
You will not get any problem with this because they are very small topic.
So how do we work.
Let me show you these that what they have in their working their work simply like.
First I need to have my variable B and then just add the method like first.
Back then the printed save this one and now when you run this file you will get your button.
Here it is on the top and middle of the columns.
Now if I also had the geometrical window geometry
and that money's say 400 x 400 this one into quotes save this one.
And now if you run this one here you will again.
We the other in geometry there is a spelling mistake maybe that is geo Amity.
Here we have extra.
My friends do and here I have this one for under 400 and the button people.
And if I add another button here that is B2
and with the name say only be you save this one.
And on this one here no.
You will get b you below this one.
Now there's some issues here.
Like what if I need my button here.
Now how can I get that one.
So bag method simply just put the button wherever it get according to the number of command it had like
be its first declare so be heavy have be about.
Then we have b do so b don't dip below B button then not to access these buttons with the locations
we have these second and third method that are grid and place really something like Hey if you notice
on this window particular here we have 13 rows.
So my first this text on number one this one is on number seven.
That is something by programming here on grid method we access the location by rules and column like
this one save.
Draw six and the first letters column 1.
So here I have B on sixth through and first column.
So if I use here grid method then I need to here pass Number two rule and number of column save one.
And also the column equal to 1.
Same here
save this one.
And now if you run this one here you will get and and b you and button here.
That is one about the dump because here we have the same row same column.
If I do this one wrote two and now run that one I will have this one on separate line but button on
first and beyond second I can also do this one first and this one second.
Now I will get b you on top.
David B although and then button on second as B have we have B you defined later but now by using grid
we had this one about you can also choose the columns.
If I do this one in two columns to say this one and if you run that one we have the B you here on column
two because first column is considered by button.
Now the third one that is the place method that I personally before you my place method you can place
your button any way you want to individual like here.
I have first one on X equal to here you need to pass x axis and Vi axis both will be in pixels save
us to one on hundred on x axis and two hundred viruses.
And the second one say hundred an x axis and three to do a D on y axis come on this and divide and D
Here I got some arrows here and denote positive y equal to now here if I had on this one day we have
this one button that is the second one so the first one on X is equal two hundred.
This is the hundred through and column equal to two hundred and this one X is equal to three hundred
and y is equal to two hundred and eighty so that's all you can use the place method to place the buttons
anywhere on the location you want to and this one is better than the other two because you can access
any location now this is all about creating a button and placing the button anyway location.
Now what about the button.
At present the button is useless.
It doesn't do anything.
It is just a button on my finger.
So what is the benefit of a empty bed for that one we use here.
The options if you go to the notes and open the buttons notes you will find first of all here we had
this syntax is there we have dependent widows in which we have is the main window option is the options
available.
Then here we have the options that will define everything above the button.
You can stand it's background front foreground color and you can also add commands let me show you some
of these.
You can refer any of these you phone to I will show you some device the video will be very large and
all the others have it nearly seem so you will not get any problem.
First of all if I need to make my button to do something for that I have a barometer known as.
Come on that will do something when clicking the button and for that one we have two options like adding
the come on here or defining the command and then calling the command by using a function.
But there's a problem with defining the command here.
Like if I just do print high on plugging the button then when you run this one.
And even if you do not click that particular button first let me clear this one so that you will see
on the.
Come on here you will get the output in the terminal not on the window.
We will consider that one later.
Now if I on this one.
Hey if you notice I have high on determiner not on that one.
And even if I click this one no I did not have anything happening anywhere.
So that is the drawback of adding the command on the same line.
Now what about calling to come on here.
My boss just any name CPI and define a function with the same name.
Here we have PR fences brain type.
The same common knife you save and run that one.
I have this one and there is nothing printed here on determiner but when I click this one I have high
here.
The number of times I click them the number of times I have high printed here.
So if you don't know the CEO we have that one that one that one.
Now this is about.
Come on.
That's how you can add Dickerman.
And this is how these things work.
Like when I click this one it go down there.
When I click this one this expand the whole window
so the double.
Come on.
The buttons are useless.
So have a clear grip on.
Come on now.
Let me move to other barometers.
Say what if I want my button something a proper interface like when I have my button here.
Then you notice this is something called pressed one behavior button written then near the boundaries
we have the boundary of that button.
Well we can see the walls of the particular button.
So for that we use banks.
Betting is separating the text from the boundaries and that will let me show you him if I use bad X
that is bedding of X and POS here 20 go on us and then add on this one here if you notice I have my
button and there's a gap on x axis on both.
Decide this one 20 picks up and if I need to have bedding on y axis bed y and pass this onesie 50 save
this one.
And now if I've done that one here I had this one button padding or 50 pixel on top and 50 pixel on
bottom.
So this is the padding barometer here.
Also useful one on one meeting them again and again closing this one because until I did not gross that
one here I do not get any option to write and run my commands.
So I need to get that done.
So the declines will turn here.
No one more here.
I need to tell you is the active full grown active and then v use here f for R that is not in default
and then e groaned and that will be you will pass here any color save red save this one and many you
run this one here or that one then whenever you click your button you will have the color change of
text here.
That is something you have also noticed in different buttons whenever you are doing something.
So that is you can how change the color of this text also high is still printing here.
So this is all about the button and I hope you got the idea and how how we can create digits and how
the parameters are created from now we will focus on individuals one by one but we will not go deep
like this because this one I believe give you all the idea that how these things works.
Otherwise they think to modify a very large more than three or four hours so you can do any parameter.
I will just tell you who barometer about these and all day working will be defined here.
So thanks for watching this all about the buttons.
And we will continue in the next video with canvas.