-3
所以后,我一直在试图运行这个程序,但每当我按Enter键启动它(这部分工作正常),它不断抛出这个错误:的时候老是值误差改变我的代码
ValueError: dictionary update sequence element #0 has length 1; 2 is required
这是触发这一行:
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(str(words[1]), text=str(words[0]))
scoreLabel.config(text="Score: " + str(score))
我知道,它可能是在
(str(words[1])
部分原因是我CH在那里篡改了一些代码来尝试修复另一个错误(我这样做)。那么有什么我错过/错过了吗? 谢谢。
这里没有足够的代码来告诉你什么是错的。 –
完整的代码和追溯错误。 – Leb
另外,你想用'label.config(str(words [1]),text = str(words [0]))''做什么? –