user1956027
user1956027

Reputation: 31

Tkinter python quit/exit crash

Im making a GUI and want to add an exit button to close the window. The only problem is, when i add a button with the following code:

root = Tk()

Exit = Button(root, text = "Quit", command = root.quit()).grid(row = 6, column = 1)

the GUI window crashes. Im running windows 7 and Python 3.2.

Upvotes: 2

Views: 1619

Answers (1)

ShroomBandit
ShroomBandit

Reputation: 441

Try this:

root = Tk()

Exit = Button(root, text = "Quit", command = root.quit).grid(row = 6, column = 1)

in the root.quit() I took out the parenthesis. See if that solves the problem

Upvotes: 3

Related Questions