Hey everyone.
So in this video we are going to go two more important vigils.
That is menu button and menu bar here.
These things if you see these things.
This is a menu bar.
And these particular options here are known as menu buttons.
So here in this video we are going to London how we can create this one because without these your program
the light did not have much features so here we have the item and we begin with creating a menu button.
So creating the menu button menu bar is a little atypical.
You need to remember few lines and just delays.
Do you really require design activity.
So by practicing 2 4 times you will learn that honestly so let me begin with creating a valuable and
be new voting menu button then add David you name menu button fences be your new Dedmon so in window
after that one detects to open that one say five after that one enough for this one just M.B..
Great.
Now at this point our button is created that is menu button but if you want this one here no going out.
We have this.
So here you have this one but nothing will happen on clicking this one.
So in this case this one is a simple button so to add some features you need to add here some more lines.
First you need to create this one in a basic menu like a menu with only one button.
Here we have four options right now.
In that case we have only one.
So for creating this one into a menu remember these two lines always M.B. dot menu here and these my
variable dot menus a method which create this one as a menu so that you will have different options
in that one.
And here you need to add another widget using Uruguay to create this widget into a menu.
So here we have menu because at this point our menu button is created here.
This is a menu button.
But without any function so to function it you're required to create this name to a menu.
So here we have this one menu pasta variable you need to convert.
Here we have this one no.
After that one you need to add this line that is M.B. square back its menu equal to M.B. not many.
Always add this line while you're creating menus.
I will tell you what this one in a way when we are done with this one.
So after this one we need to add some features in this net what will be represented here like when clicking
this one.
These three options are popping up here so to add these requests and variables again see X1 and X2 or
if you want to add more than two you can add more or more also Hill y variables.
Because again these things are just taken at 0 and 1.
Like when I did not have clicked any of these all these are on zero when I click any one of these the
variable will win on state and that value will be won.
So for these we will have Incredibles because they are just 0 and 1 so in red again.
Now we have the variable and we will create the menu buttons.
Now so for that one we have m b menu that is of M.B. here.
This is also the menu FNB now we will add here a check button.
Just simply add underscore check button.
Now you can add any value here beginning with a label say open and variable is x 1.
Now we have using this menu that we have created by using the menu widget or you can just imagine this
one as an another variable.
We have created the December menu by creating the end bean to a menu after this event.
If you want to add second one this one is set close and this one x 2 than we did the after they didn't
last just at M.B. back tobacco is ready.
Now if you run this one they've had this one and
when you click this one you will get these options popup here that is open and close so I hope you got
this one.
That's how you have created the menu button.
And then how you have created that menu button into a menu bar so that we can have different options
in that one that I open and close.
Now after this one let me create a perfect menu so that we can have different options like these and
all all which contain different options and then so let.
Just to remove this one first and now begin with that.
First of all we need to have a clear view that what we need to define him.
So this one seems to be very difficult but once you understand this one this is very easy.
So let create debt.
But first of all we required to create a menu like this one so if you properly notice on these files
then here we have different bunch of menu buttons and they themselves are menus when you click any of
these you will get different options in them.
And if you have some menus also.
So what we are required to do here is first we need to define a menu that is this about one in that
one.
We again need to define these sub menus in which we have different options.
So let's begin with Dedmon first of all.
Before doing this one more thing that these options here menu click any of these they perform some action.
But we are not working on actions right now.
So what we are going to do here.
We will send the command for each button to I don't think Come on in which a simple popup window shows
do nothing.
I think you understand what I'm saying here.
Now before doing anything let me first define a function saying nothing dismount but really do whenever
any button is clicked on our menu then it will make a top level window with a button saying do nothing.
So you can make anything if you want or you can even loop empty but to check the buttons we are doing
that one.
So here we are taking an example Fi and that will be top level in window.
So we are making a sub window and that will contain a button.
So here we have a button in that they know that is over fight and the text on that one is do not take
symbolized it.
And the just button or back when something is clicked.
So this is a function I think you understand this.
And when I show you this one you will understand it much more better.
Now let me create a menu.
So creating a menu is very easy.
You just need to create that we have a menu bar.
This one is about is known as a menu bar and you can just clear this one simply menu and very require
that one win.
So at this point this one is created no now to unpack this one.
This is the on from the last one.
You need to do window dot configure that is for configuration of this menu bar and in that one provide
menu name that is of a menu bar.
So this is how you can create a menu bar.
But right now this menu bar contains no element.
And if you tried to run this one and three did not keep the eye you will get an empty menu bar.
If you notice here on the above we have nothing.
Just despite the so that's why because we don't have anything here.
No next we add some files here just like this file added and see ahead.
So we will add these three.
You can add any number of menu buttons here you want to.
So let's begin with that one here.
I define a variable file menu here.
This one is just a variable.
And it contains all the files that are in this one so in short I'm just creating this one this file.
But the back end of this file ought to see a function.
So this one will be again a menu inside a menu.
So understand it clearly that what I'm doing here is this one.
This is also a menu and where it is inside this menu just like we have the top level windows like the
one the the message box when I click this one on popup message appears so similar to that one we have
menus inside menu.
So first I'm creating the inside menu and then I will call it once to make this happen.
So first of all this will be equal to menu inside our window so know no double window inside this menu
bar because that one is inside this one.
After that here we are done with this one.
We have not created a file menu that is inside the menu bar.
Now if you want to add some things like this one then we'll how to do that.
So for creating this one just move to your notes and check the creating menu.
Now what do you require.
You need to add some values here.
So if you go to the methods and look out that how can I do that.
You will find this one add comment.
Come on this will add some menu item to the menu.
So you generally add these items to the menu.
So we require these kind of fight maybe.
So it didn't matter no let me check that do we can do something with Deadpool.
So here how to use that matter.
Just do a filing menu valuable to add these files dot Ed underscore.
Come on.
This one is not likes calling the function it generally adds the items to inside of that one just pass
the label say like if they want this one then first of all we have new window.
So here I have new and then Vindaloo after that one pass command that will happen on clicking that one
and call dysfunction.
So that's why we have defined that function.
Now if you want to define more there just copy this one and paste it as many times as you have the number
of commands like here we have new file open so just add few more.
That is new file then open.
After that when we have a close
save
save as or anything not necessary.
These things say add here bugger a best friend.
And after that one see what you like.
Now we have look as close dead.
So here we have closed.
So there is no foundation you can even go from this point to up to this point adding hundreds of commands.
Now at this point no we are done with adding the commands.
What we need to do now is we need to make this file right now.
One more thing.
If you notice in this one here we have separations like the opening the file and something like that.
We have about then we have a line separation.
Saving these then a separation.
Closing taps.
So if you need these kinds of separation then we have a separate matter.
You can also check that one here at separator.
This one adds a separate line so to add that phone just whatever you want to add that one go to that
point like if I have these for opening and closing files I'm adding this one here just simply file menu
at Invesco separator as CPA order to your loss and copy this one
and I'm adding Len after these save functions here.
And one in the last one more thing of a menu something like not doing anything at all.
All the functions are nothing.
So I'm adding a command here so that it will do something right.
It will be completely useless and that come on is say exiting to exit of a application so for that fun
here just you in command You need to change this function that is doing nothing.
And I have take an example of exit because that is very simple Come on just window of a window that
is open there and quit.
There we go.
No panties and nothing at all.
No at this point all this belongs to this inside function or we can see the inside menu bar.
Now we have created this one but at this point this is not in the menu bar.
Like if you run this one there is terminal it is due on the last one.
Now if you run this one you will not get anything there but you have created all this.
The reason for that one is you need to attach this file menu to this menu but this is already in the
menu bar.
But again it requires attachment and to attach any menu to the other.
Here we have a function that is known as Ed cascade.
It will create a new had called menu by associating a given menu to the pad and menu means it's creating
a menu inside the pattern.
So for that one you need to remember.
Come on and need to always use this one that is of a menu bar underscored.
So we don't underscore and underscore guest good.
So you need to use this method here at underscore tested.
And in that one provide what you are adding them with a label.
So like I need to add this label fight.
Same to same.
So hey I have five and I'm adding here my menu that is file menu Libya this one.
Now if you'll save this one and run it again here you get this file as you can notice here in this one
you are not getting something because this means Mac in Mac we have a bunch of options here.
But if you are using Windows then you are maybe you are getting here all the options so don't worry
about that one will you are getting just you are getting that is perfect.
So if you click that one you will have all these options here that we have written him new window new
file open that is open in a spelling mistake then closed saves savers and these lines well we can say
these separators then debugger closed tab and exit.
And if you click on any of these our do nothing function look here are top level window popup which
is showing donating button.
So this one is a button not a label because we have added a button in that date is now of only [REMOVED]
element here that is except when you click this one the application closed.
So in that case you do not reply to that one.
Now we are done with this one just open.
Now if you want to add more like we are going for EDIT also.
Then this same operation like this one still photo.
We have see added menu and that will be menu in Pence's bus menu but day we have this one after that
one provide options like these in added We have unloaded all cut copy paste.
So let me try some of these.
So for that copy this one.
So it is not required to do again and again Come on see and come on.
V here just JS this file menu to add it.
And let me do something as you instead of changing in every one just copy that one Oh dear we have.
I think these are enough close to one.
I know then we have real after dead got
Kobe and after dead we have this one say based what has them select olds and say this one Dexter lines
so select all
or just add in last.
The execution date need to be a next it everywhere.
We have an exit and the lines appear to copy from there.
One after these undo and redo one after this.
We have this.
Now a menu what is also.
So the edit board is also created.
So if you see him first one is very difficult to create.
It required a lot of functions there but once you get that one then destroyed.
This begins very easy so just make a little practice of this one so that you will get comfortable with
this one and then you will never forget anything about this.
Now here we have done with this one.
Now the second step you need to cascade this one so the cascade land copied the base that will hit and
instead of that one here we have no added Min save this one and this one also edit
now say this come on us.
And if you run this one now we will get to menu here.
That is just one file.
Second one.
Edit And don't cut paste all these exit and we have two more.
Maybe because of added them in file of an openness also changed.
And again if you click exit we are doing nothing.
Why.
Because we have not added the command of exit here.
We have just nothing there.
So only when don't quit.
You know defenses save this one and try this one now.
So there we go with that exit and the application is closed now.
I hope you got that one right now.
So there is no need to add another help option here I believe because the video is already too long.
Will get bored with that.
So I am skipping the last one.
I believe you will do that one and this is enough for understanding the menu.
So thanks for watching and see you later.