What this gives us is basically a plain old blank Tkinter window, not too exciting. The next thing we are going to do is add create our root menu, before going any further you might want to read the excellent information about menu widgets in PythonWare’s Tkinter introduction. You don’t have to but it’s an excellent source of information.

To create the root menu we simply add the following command to our __init__ function:

No we are greeted with, well a blank window with a blank menu, the reason for this is because we haven’t added anything to it. What we are going to add to it is a menu, but not just any menu, a menu who’s parent is our menu base:

That’s basically it! Adding the menu item’s is pretty simple, we specify it’s text and then tell it what function to call when the user clicks on the menu item. The two functions that I used don’t really do anything besides show a message box:

Having trouble with menus — specifically, I get a window, no menu. I’ve tried your example, pasting it in. Tried several others too. Same unsatisfactory result: A window, but no menu.

I’m beginning to suspect that the current Python download is defective — how else to explain same result with at least 4 independent ‘text book examples’. I’d tell you what versions I’m using if I knew how to find it. (Learning my way around OSX and Unix at the same time. This is a Mac OSX10.4.7. The Python is ‘probably’ 2.4.

If you want to test what version of python you have installed on your system simply run “python” from the Terminal to launch the interactive editor. You should get a message like this that shows your version:

I’ve tested the code with version 2.4.2 and 2.5 and both work properly on my Mac. One thing to remember is that the menu’s will not show up on the window, they will appear in the “menu bar” along the top of the screen where menu’s appear on OS X.

Take a look at the screenshot in the tutorial and I think you’ll see what I mean.