看似格式正确的代码中的Python语法错误

时间:2014-10-12 19:29:35

标签: python syntax syntax-error

我在elif not running:的代码中遇到语法错误,但我不明白为什么。似乎所有内容都被正确格式化了,但我仍然遇到了语法错误。

running = True
def checker():
    global running
    if running:
        if label.image == colorPhoto:
            label.image = blackPhoto
            label.configure(image = blackPhoto)
            #GPIO.output(16,True)
            #root.after(2000,checker)
        elif label.image == blackPhoto:
            label.image = colorPhoto
            label.configure(image = colorPhoto
            #GPIO.output(16,False)
            #root.after(2000,checker)
    elif not running:
        label.image = colorPhoto
        label.configure(image = colorPhoto)
        #GPIO.output(16,False)
def press():
    global running
    if not running:
        running = True
        checker()
    if running:
        running = False

1 个答案:

答案 0 :(得分:0)

您错过了label.configure(image = colorPhoto

)的结束括号