Python Tkinter Examples
Python
#!/usr/bin/python
from Tkinter import Tk
from Tkinter import *
from tkMessageBox import *
def TakePicture():
print "Take Picture!"
def GetInfo():
print "Get info..."
def About():
'About', 'This is a simple example of a menu')
showinfo(
= Tk()
root "Grid Test")
root.wm_title(
= Menu(root)
menu =menu)
root.config(menu
= Menu(menu)
filemenu ="File", menu=filemenu)
menu.add_cascade(label="Exit", command=root.destroy)
filemenu.add_command(label
= Menu(menu)
toolmenu ="Tools", menu=toolmenu)
menu.add_cascade(label="Take Picture", command=TakePicture)
toolmenu.add_command(label
= Menu(menu)
helpmenu ="Help", menu=helpmenu)
menu.add_cascade(label="About...", command=About)
helpmenu.add_command(label
= Button(root, text='Info', width=20, command=GetInfo)
btnInfo =1,column=0,padx=5,pady=5)
btnInfo.grid(row
= Button(root, text='Quit', width=20, command=root.destroy)
btnQuit =1,column=1,padx=5,pady=5)
btnQuit.grid(row
= Label(root, text="Ready")
statusLabel =2,column=0)
statusLabel.grid(row
mainloop()