2016-08-08 24 views
0

私はログインスタイルのスクリーンを作成し、パスワードが一致するとフレームを後ろに戻そうとしています。プログラムを実行するとエラーAttributeError: 'str' object has no attribute 'get'が発生します。AttributeError: 'str'オブジェクトの属性に「get」というエラーがありません

class StartPage(tk.Frame): 
    entry = "placeholder" 
    def framechange(self): 
     if self.entry.get() == "password": 
      command = lambda: controller.show_frame("PageOne") 
    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) 
     entry = tk.Entry(self, show="•") 
     entry.pack(side="top", fill="x", pady=10, padx=10) 
     button1 = tk.Button(self, text="Login",command = self.framechange) 
     button1.pack() 

感謝

答えて

0

クラスの内部から呼び出されるいかなるget()要求はありません。また、あなたの入力文でselfが欠落しています

試してみてください。

class StartPage(tk.Frame): 
    entry = "placeholder" 
    def framechange(self): 
     if self.entry == "password": # Changed 
      command = lambda: controller.show_frame("PageOne") 
    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, show="•") # Changed 
     self.entry.pack(side="top", fill="x", pady=10, padx=10) # Changed 
     button1 = tk.Button(self, text="Login",command = self.framechange) 
     button1.pack() 
ログインボタンが押されたときにそれは何もしていない
+0

、私はのための入力フィールドから情報を取って何もないので、これがあると思いますボタン1のコマンド – BadUserName

+0

@ user217591あなたは '自己を忘れたのか分からなかった。 –

関連する問題