2015-10-05 39 views
-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在那里篡改了一些代码来尝试修复另一个错误(我这样做)。那么有什么我错过/错过了吗? 谢谢。

+2

这里没有足够的代码来告诉你什么是错的。 –

+0

完整的代码和追溯错误。 – Leb

+0

另外,你想用'label.config(str(words [1]),text = str(words [0]))''做什么? –

回答

2
label.config(str(words[1]), text=str(words[0])) 

config只接受一个命名参数,但您给它一个命名参数和一个位置参数。尝试:

label.config(text=str(words[0])) 
+0

感谢您的帮助,下次我将尝试正确构建我的问题。 – Ernxst

相关问题