-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]))''做什麼? –