Python IndentationError在i处

2024-04-20 14:00:16 发布

您现在位置:Python中文网/ 问答频道 /正文

这是密码

def properties(imgnum):
    ...
    if imgnum == 6:
        bonus = 0
        #img6.gif
        photo = tkinter.PhotoImage(file = './Images/img6.gif')
        root.geometry("450x450")
        root.update()
        canvas.create_image(225,225, image=photo)
        root.mainloop()
        props = {...}
    if imgnum == 7:
        bonus = 0
        #img7.gif
        photo = tkinter.PhotoImage(file = './Images/img7.gif')
        root.geometry("450x450")
        root.update()
        canvas.create_image(225,225, image=photo)
        root.mainloop()
        props = {}
    if imgnum == 8:
        bonus = 0
        #img8.gif
        photo = tkinter.PhotoImage(file = './Images/img8.gif')
        root.geometry("450x450")
        root.update()
        canvas.create_image(225,225, image=photo)
        root.mainloop()
        props = {}

下面是错误:

Traceback (most recent call last):
  File "C:\Users\[USER]\Desktop\Eoy\EOY.py", line 1, in <module>
    from EOY_props import properties
  File "C:\Users\[USER]\Desktop\Eoy\EOY_props.py", line 55
    if imgnum == 7:
     ^
IndentationError: expected an indented block

我听说这是从混合标签和空间,我没有这样做。 所有代码与其他代码是偶数,所有括号和方括号都是闭合的。 道具字典在待办事项清单上,这都是正在进行的工作。你知道吗


Tags: imageiftkinterupdaterootpropsgiffile