So I am creating a game, and now I have decided to add a GUI. The GUI code is shown as follows:
master = Tk()
master.wm_title("Main Menu")
a = Button.grid(master, text = "DOMINATE!", command = difficulty)
a.grid(row = 0, column = 0)
a.pack()
mainloop()
b = Button.grid(master, text = "Patch Notes", command = changelog)
b.grid(row = 0, column = 1)
b.pack()
mainloop()
c = Button.grid(master, text = "Credits", command = credit)
c.grid(row = 1, column = 0)
c.pack()
mainloop()
d = Button.grid(master, text = "Rules", command = rules)
d.grid(row = 1, column = 1)
d.pack()
mainloop()
e = Button.grid(master, text = "Quit", command = exit)
e.grid(row = 2, column = 0)
e.pack()
mainloop()
I have already imported the function * from Tkinter and this is just a snippet of my 1200 lines of code. When I try to run it, I get this error:
TypeError: unbound method grid_configure() must be called with Button instance as first argument (got Tk instance instead)
(Python is kind of a new language for me so sorry for missing anything obvious or stupid. I am also kind of new to programming).
Button.grid(with justButton(text,command,rowandcolumnat each iteration). not that it's impossible, but I'm not sure if it would make the code more clear ...mainloopis designed to be called only once. I can't imagine how your code runs the way you have it in your question.