由于某些原因,尽管事实上它从字符串中取出的列表与颜色无关,但Python仍然会在“未知颜色”的位置抛出TCL错误。这有什么理由吗?Python误解了我的列表
#Add words to this list to include them in the game
words = ["Games","Development","Keyboard","Speed","Typer","Anything","Aplha","Zealous","Accurate","Basics","Shortcut","Purpose","Window","Counter","Fortress","Modification","Computer","Science","History","Football","Basketball","Solid","Phantom","Battlefield","Avdvanced","Warfare","Download","Upload","Antidisestablishmentarianism","Supercalifragilisticexpialidocious","Discomobobulation","Liberated","Assassin","Brotherhood","Revelation","Unity","Syndicate","Victory"]
def nextWord():
global score
entry.focus_set()
if entry.get().lower() == words[1].lower():
score += 1
entry.delete(0, tkinter.END)
random.shuffle(words)
label.config(fg=str(words[1]), text=str(words[0]))
scoreLabel.config(text="Score: " + str(score))
这是新的错误:
ValueError: dictionary update sequence element #0 has length 1; 2 is required
而且,我知道有些/大多数我的代码也许不正确的,我想知道如何设置的次最高金额洗牌并且在打印它们在标签中通过它们所花费的时间之前显示一个字符串。 (次要问题,不必回答,如果你不想) 谢谢。
如果您收到异常,请发布堆栈跟踪,并确定哪条线路导致问题。 – khelwood
对不起,我是新来的,但我已经改变了它 – Ernxst