Python | Menu

/ 2 Aug 2013 /
o.m.g SO COOL. here it is,  i can not be bothered to post a picture, so just run it yourself.



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import sys
from tkinter import *

def mNew():
    mlabel3 = Label(app, text='if this works then omfg').pack()
    return

app = Tk()
ment = StringVar()

app.title('Menu app!')
app.geometry('600x400')


#Menu
menubar=Menu(app)

filemenu=Menu(menubar, tearoff = 1)
filemenu.add_command(label='New', command = mNew)
filemenu.add_command(label='Open')
filemenu.add_command(label='Save As...')
filemenu.add_command(label='Close')

editmenu=Menu(menubar)
editmenu.add_command(label='Canvas')
editmenu.add_command(label='Print')
editmenu.add_command(label='Copy')
editmenu.add_command(label='Paste')



menubar.add_cascade(label='File', menu=filemenu)
menubar.add_cascade(label='Edit', menu=editmenu)

app.config(menu=menubar)












app.mainloop()
 
Copyright © 2010 M(ath)+me, All rights reserved