-1
パスワードを保存する基本的なログインプログラムを作成しようとしていますが、パスワードの初期画面を作成する際に問題があります。entry
からエントリを取得しようとしています。名前「エントリ」あなたがにself
キーワードを使用する必要がNameError:name 'entry'が定義されていません
class StartPage(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
self.controller = controller
label = tk.Label(self, text="Welcome", font=TITLE_FONT)
label.pack(side="top", fill="x", pady=10)
self.entry = tk.Entry(self, text="lol")
self.entry.pack(side="top", fill="x", pady=10, padx=10)
def framemove():
if entry.get == "password":
controller.show_frame("PageOne")
else:
tm.showerror("Login error")
button1 = tk.Button(self, text="Login", command=framemove)
button1.pack()
感謝
私はもうエラーメッセージが表示されなくなりましたが、パスワードを入力しようとすると入力内容に関係なく間違っています – BadUserName
'if self.entry.get()==" password ":print( ' right ')else:print(' wrong ') 'チェックアウトして何が起こるか教えてください。それがうまくいくなら、あなたの間違いは上記のケースで返されます。 –
どちらの場合もまだ間違っています – BadUserName