Hello friends welcome back. Today in this video I will discuss about taking many most people if converted with the word man you will immediately think of one menu in a restaurant. Even though the menu of restaurant and the menu of computer program at first glance nothing common we can see that I have a lot in common in restaurant menus presentation of all the various offerings while in a computer program, it presents all the commands functions of application which are available to the user by the graphical user interface. menus ns UI are presented with a combination of text and symbols to represent the choices, selecting with the mouse or anger otters. Anything on one of the symbols or text and actually we'll be starting a new type function we'll be starting such an excellent or operation can be example with the opening or saving the file or quitting or installing the application etc.
And many options can be like in Notepad, cut, paste, edit options, these are all examples we see in real world. Context menu is a menu and business versus presented to the use of modified according to the current context in which the user is located. So, the motive of my This video is to give you a good example for how to use menu to enter menu and I will implement an application in which there will be File, Edit or many commands and that works. application. So let's start. Before starting, these are some syntax of menu.
The goal of all kinds of application actually before the three types of menu types pop up, top level and pull down. functions, add command, add check button, add Preview button, add cascade add separator. I will, I will show you all this function in my application. So open ID Do name their script and stands for menu menu many many Ruth, Ruth another instance File Menu, menu dot add cascade on the function of taking too many cats new firemen you know, I mean, add command another function of TK enter menu add command label new neighbor to artists this new command new file there's no add on options after this oh then Then I know I'm going to use ad separator. So then I can add one more command, exit, exit. And for this new command exit or we can also write directly route dot quit.
This is used for closing our application first. More menus new dirt at K Okay. Yeah. Same thing I knew are not here, right? And then you come on me. No, again, right?
Come on, come on. This as many as many about anything you want to write about. Now let's make our function Okay, fine. Fine. New fine. So did I choose that menu?
No copy this. First of all that anything you want right This is an example of anything. And here open open files as they import US Open File name from TK file dialog. So, I'm going to right knee equal to open file. Name, print, name, print name Now save this file and run it. Oops, sorry for that I'm not installed.
Tk file dialog. So I couldn't perform this task as open file name. So for too long, I make this a command. And sorry, comment, pen fight. Now Save and run this program, run this script and use no defined Now click on File, three components are the new new file open open file for exit, it will quit and then about this and for help about this is a simple menu example. Firstly we created one instance menu instance here and then inside this menu we added to Gasquet file, file and other one help inside file we added three commands.
First one is new, then open then we added separator this line, this line is a separator and then exit and for health about only added one command and this computer take into take into menu module. So, so for tillow happy coding, keep learning and keep moving