I am trying to learn how to make a basic GUI in Python with menus.
I have been following a tutorial from 2014 (https://www.youtube.com/watch?v=PSm-tq5M-Dc), but it seems that several things have been updated since the tutorial was published.
While I have found workarounds for several of my issues there were a couple I could not figure out.
The biggest issue of which is a "TypeError: add_cascade() missing 1 required positional argument: 'self'"
error.
Everything I can find seems to have similar syntax to my code however I cannot seem to run it. I think it is probably a difference in python versions (I am running python 3.7
) though it is also likely I am just missing something in the tutorial.
import tkinter
def doNothing():
print("DO SOMTHING USEFULL... please")
root=tkinter.Tk()
menu=tkinter.Menu(root)
root.config(menu=menu)
subMenu=tkinter.Menu(menu, tearoff=0)
tkinter.Menu.add_cascade(label="file", menu=subMenu)
subMenu.add_command(label="New Project...", command=doNothing)
subMenu.add_command(label="New...", command=doNothing)
subMenu.add_seperator()
subMenu.add_command(label="Exit", command=doNothing)
editMenu=tkinter.Menu(menu)
tkinter.Menu.add_cascade(label="Edit", menu=editMenu)
editMenu.add_command(label="Redo", command=doNothing)
root.mainloop()
P.S. I know I do not have to put "tkinter." everywhere but I could not seem to get "from Tkinter import *" to work for me.
How do I solve the following error?