AttributeError:'str'对象在代码中没有属性'get'错误

时间:2016-08-08 03:06:07

标签: python get

我正在尝试创建一个登录样式的屏幕,并且如果密码匹配则会引发框架,当我运行程序时出现错误Edit -> Sort Lines (F9) Edit -> Permute Lines -> Unique

AttributeError: 'str' object has no attribute 'get'

非常感谢

1 个答案:

答案 0 :(得分: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()