In the following program, instead of displaying the interfaces one by one, it directly displays the 3rd interface when the Run button is pressed.
import Tkinter
root = Tkinter.Tk( )
root.title("My First Game")
for r in range(3):
for c in range(3):
Tkinter.Label(root, text= '3', borderwidth=20 ).grid(row=1,column=1)
Tkinter.Label(root, text= '6', borderwidth=20 ).grid(row=1,column=2)
Tkinter.Label(root, text= '4', borderwidth=20 ).grid(row=1,column=3)
Tkinter.Label(root, text= '2', borderwidth=20 ).grid(row=2,column=1)
Tkinter.Label(root, text= '7', borderwidth=20 ).grid(row=2,column=2)
Tkinter.Label(root, text= ' ', borderwidth=20 ).grid(row=2,column=3)
Tkinter.Label(root, text= '5', borderwidth=20 ).grid(row=3,column=1)
Tkinter.Label(root, text= '1', borderwidth=20 ).grid(row=3,column=2)
Tkinter.Label(root, text= '8', borderwidth=20 ).grid(row=3,column=3)
def mainprg():
for r in range(3):
for c in range(3):
Tkinter.Label(root, text= '3', borderwidth=20 ).grid(row=1,column=1)
Tkinter.Label(root, text= '6', borderwidth=20 ).grid(row=1,column=2)
Tkinter.Label(root, text= ' ', borderwidth=20 ).grid(row=1,column=3)
Tkinter.Label(root, text= '2', borderwidth=20 ).grid(row=2,column=1)
Tkinter.Label(root, text= '7', borderwidth=20 ).grid(row=2,column=2)
Tkinter.Label(root, text= '4', borderwidth=20 ).grid(row=2,column=3)
Tkinter.Label(root, text= '5', borderwidth=20 ).grid(row=3,column=1)
Tkinter.Label(root, text= '1', borderwidth=20 ).grid(row=3,column=2)
Tkinter.Label(root, text= '8', borderwidth=20 ).grid(row=3,column=3)
B = Tkinter.Button(root, text = "Run", command = mainprg)
B.grid(row = 4, column = 1)
def mainprg1():
for r in range(3):
for c in range(3):
Tkinter.Label(root, text= '3', borderwidth=20 ).grid(row=1,column=1)
Tkinter.Label(root, text= ' ', borderwidth=20 ).grid(row=1,column=2)
Tkinter.Label(root, text= '6', borderwidth=20 ).grid(row=1,column=3)
Tkinter.Label(root, text= '2', borderwidth=20 ).grid(row=2,column=1)
Tkinter.Label(root, text= '7', borderwidth=20 ).grid(row=2,column=2)
Tkinter.Label(root, text= '4', borderwidth=20 ).grid(row=2,column=3)
Tkinter.Label(root, text= '5', borderwidth=20 ).grid(row=3,column=1)
Tkinter.Label(root, text= '1', borderwidth=20 ).grid(row=3,column=2)
Tkinter.Label(root, text= '8', borderwidth=20 ).grid(row=3,column=3)
B = Tkinter.Button(root, text = "Run", command = mainprg1)
B.grid(row = 4, column = 1)
root.mainloop()
What should i do to display a series of interfaces by clicking the Run button?