All tkinter functions run when program starts All tkinter functions run when program starts tkinter tkinter

All tkinter functions run when program starts


Remove the ()s in your command definitions. Right now, you are calling the function and binding the return values to command parameter whereas you need to bind the functions itself so that later on they could be called.

So a line like this:

filemenu.add_command(label="New...", command=self.new())

should actually be this:

filemenu.add_command(label="New...", command=self.new)

(You actually do this in one place correctly: filemenu.add_command(label="Exit", command=app.quit))


filemenu.add_command(label="Open...", command=self.open())filemenu.add_command(label="New...", command=self.new())filemenu.add_command(label="Open...", command=self.open())filemenu.add_command(label="Save", command=self.save())

In these lines, you have to pass the reference to the functions. You are actually calling the functions.

filemenu.add_command(label="Open...", command=self.open)filemenu.add_command(label="New...", command=self.new)filemenu.add_command(label="Open...", command=self.open)filemenu.add_command(label="Save", command=self.save)