2017-10-14 2 views
0

私は現在、学校プロジェクト用のアドレス帳のGUIを作成しようとしています。現時点では私はGUIに私の検証をリンクしますが、このエラーメッセージが出続けるしようとしています:_tkinter.TclError:不明なオプション

Traceback (most recent call last): 
File "C:\Users\katie_000\Downloads\GUI adresses practice (1).py", line 198, in <module> 
B = Button(window, width=46, text = "Add",fg="gray16", command=name()) 
File "C:\Users\katie_000\Downloads\GUI adresses practice (1).py", line 8, in name 
Sname() 
File "C:\Users\katie_000\Downloads\GUI adresses practice (1).py", line 17, in Sname 
Hphone() 
File "C:\Users\katie_000\Downloads\GUI adresses practice (1).py", line 24, in Hphone 
label.configure("You must enter a phone number") 
File "C:\Users\katie_000\AppData\Local\Programs\Python\Python36 \lib\tkinter\__init__.py", line 1479, in configure 
return self._configure('configure', cnf, kw) 
File "C:\Users\katie_000\AppData\Local\Programs\Python\Python36 \lib\tkinter\__init__.py", line 1469, in _configure 
return self._getconfigure1(_flatten((self._w, cmd, '-'+cnf))) 
File "C:\Users\katie_000\AppData\Local\Programs\Python\Python36\lib\tkinter\__init__.py", line 1457, in _getconfigure1 
x = self.tk.splitlist(self.tk.call(*args)) 
_tkinter.TclError: unknown option "-You must enter a phone number" 

誰かがこれが何を意味するのか私に言うことができれば、私はそのすべての情報を見つけることができないとしてそれは、素晴らしいことです私に役立ちます。 label.configure("You must enter a phone number")を使用して

多くのおかげ

+0

トレースバックだけでなく、関連するコードも表示する必要があります。 – mentalita

+1

しかし、トレースバックからは、そのようなラベルを設定しないと言えます。テキストを設定する場合は、そのようにパラメータを指定する必要があります。 'label.configure(text = 'する必要があります...')'。 'command = name()'にも括弧は必要ありません。 – mentalita

答えて

0

がしようとLabelウィジェットが持っている属性ではありません"You must enter a phone number"の属性とlabelを割り当てます。上記のmentalitaによって指摘されているように、ウィジェットのテキスト値を設定しようとしている場合は、label.configure(text="You must enter a phone number")のようにtext属性に値を割り当てる必要があります。

関連する問題