indentation error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

indentation error

can any one help to me to find indent error: from tkinter import * import tkinter.messagebox tk = Tk() tk.title("Tic Tac Toe") click = True def btnClick(buttons): global click if buttons["text"] ==" " and click == True: buttons ["text"] = "x" click = False elif buttons["text"] ==" " and click == False: buttons["text"] ="o" click = True elif (button1["text"] =="x" and button2["text" =="x"]and button3["text"] =="x" or button4["text"] =="x" and button5["text" =="x"]and button6["text"] =="x" or button7["text"] =="x" and button8["text" =="x"]and button9["text"] =="x" or button3["text"] =="x" and button5["text" =="x"]and button7["text"] =="x" or button1["text"] =="x" and button5["text" =="x"]and button9["text"] =="x" or button1["text"] =="x" and button4["text" =="x"]and button7["text"] =="x" or button2["text"] =="x" and button5["text" =="x"]and button8["text"] =="x" or button3["text"] =="x" and button6["text" =="x"]and button9["text"] =="x"): elif (button1["text"] =="o" and button2["text" =="o"]and button3["text"] =="o" or button4["text"] =="o" and button5["text" =="o"]and button6["text"] =="o" or button7["text"] =="o" and button8["text" =="o"]and button9["text"] =="o" or button3["text"] =="o" and button5["text" =="o"]and button7["text"] =="x" or button1["text"] =="o" and button5["text" =="o"]and button9["text"] =="o" or button1["text"] =="o" and button4["text" =="o"]and button7["text"] =="o" or button2["text"] =="o" and button5["text" =="o"]and button8["text"] =="o" or button3["text"] =="o" and button6["text" =="o"]and button9["text"] =="o"): label = Label( tk, text="Player 1:", font='Times 20 bold', bg='white', fg='black', height=1, width=8) label.grid(row=2, column=0) button1 = Button(tk, text=" ", font='Times 20 bold', bg='gray', fg='white', height=4, width=8, command=lambda: btnClick(button1))

14th Apr 2020, 11:11 AM
koventhan
koventhan - avatar
2 Answers
+ 1
You have no indented blocks after each of your long elif conditionals. You have the idea, because you used indentation correctly for your initial if and first elif.
14th Apr 2020, 11:33 AM
Russ
Russ - avatar
+ 1
Hay bro just cheque last 5th and 8th line
14th Apr 2020, 11:37 AM
Ayush Kumar
Ayush Kumar - avatar