I’m getting a segmentation fault everytime i want to run this code :
from Tkinter import *
def gui():
root=Tk()
menubar=Menu(root)
filemenu=Menu(menubar,tearoff=0)
filemenu.add_command(label='New',command=gui)
filemenu.add_command(label='Close',command=root.quit)
menubar.add_cascade(label='File',menu=filemenu)
helpmenu=Menu(menubar,tearoff=1)
helpmenu.add_separator()
helpmenu.add_command(label="Help")#ajouter commande
helpmenu.add_command(label='About...')#ajouter commande
helpmenu.add_cascade(label='Help',menu=helpmenu)
root.mainloop()
gui()
Any suggestion ?
What should i do ?
Thank you in advance.
MFF
The segfault is caused by:
after a quick look at the docs, it makes perfect sense why that would give you problems. Add cascade “adds a hierarchical menu item”. You are adding helpmenu as a menu within helpmenu.
I believe that what you mean here is