Add menu to a window : Menu « GUI Tk « Python

Python
1. 2D
2. Application
3. Buildin Function
4. Class
5. Data Structure
6. Data Type
7. Development
8. Dictionary
9. Event
10. Exception
11. File
12. Function
13. GUI Pmw
14. GUI Tk
15. Language Basics
16. List
17. Math
18. Network
19. String
20. System
21. Thread
22. Tuple
23. Utility
24. XML
Microsoft Office Word 2007 Tutorial
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Python » GUI Tk » MenuScreenshots 
Add menu to a window
Add menu to a window

from Tkinter import *

def callback():
    print "called the callback!"

root = Tk()

create a menu
menu = Menu(root)
root.config(menu=menu)

filemenu = Menu(menu)
menu.add_cascade(label="File", menu=filemenu)
filemenu.add_command(label="New", command=callback)
filemenu.add_command(label="Open...", command=callback)
filemenu.add_separator()
filemenu.add_command(label="Exit", command=callback)

helpmenu = Menu(menu)
menu.add_cascade(label="Help", menu=helpmenu)
helpmenu.add_command(label="About...", command=callback)

mainloop()


           
       
Related examples in the same category
1. A big menu bar
2. Set up menu and add action to it
3. Disable a menu itemDisable a menu item
4. Set menu item font
5. Menu item mouse on (active) foreground colorMenu item mouse on (active) foreground color
6. Underline for menu item textUnderline for menu item text
7. Menu separatorMenu separator
8. Cascade MenuCascade Menu
9. Disable a menuDisable a menu
10. Creating a small menuCreating a small menu
11. Menu separator 2 and menu action
12. Menu actionMenu action
13. A Simple Form with Menu
14. Three Menu inside a formThree Menu inside a form
15. Framework for a single document interfaceFramework for a single document interface
16. 3 popup windows with menus3 popup windows with menus
17. Menu/tool bars packed before middleMenu/tool bars packed before middle
w__w_w_.___j___av__a_2___s_.__c_o_m__ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.