Using Python GUID 'tkinter' for displaying Menu and Toolbar sample

from tkinter import *

def Test():
    print ("Testing!")

root = Tk()

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

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

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

# create a toolbartoolbar = Frame(root)

b = Button(toolbar, text="new", width=6, command=Test)
b.pack(side=LEFT, padx=2, pady=2)

b = Button(toolbar, text="open", width=6, command=Test)
b.pack(side=LEFT, padx=2, pady=2)


mainloop()

Here is a sample to play with.

Comments

Popular posts from this blog

AWS: Benefits of using Amazon S3

Google To Acquire Looker For $2.6 Billion

Python - GUI - Tkinter(Bar & Pie Chart)