Hi,
The same code as my previous post, but because of this list thing, i'm not able to run specific commands for different options. Here i have 2 options under the 'Names' Menu, 'rajat','prasun', now when the user selects either of them i should be able to know which one he selected and run the command associated for it. i've tried some stuff like trying to use 'variable' or 'value' properties but its just not working.. any hints would be helpful..
from Tkinter import *
fileObj = open("c:/test","w")
fileObj.write("rajat")
fileObj.write("\n")
fileObj.write("prasun")
fileObj.close()
file1 = open("c:/test","r")
lines = file1.readlines()
file1.close()
root = Tk()
menubar = Menu(root)
filemenu = Menu(menubar)
menubar.add_cascade(label="Names",menu=filemenu)
for line in lines:
filemenu.add_cascade(label=line)
root.config(menu=menubar)
root.mainloop()