当我正在为一个用户创建一个字符串时,我正在尝试通过一个用户登录来注册一个用户,但我正在尝试通过两个字符串来注册这个模块:
TypeError: argument of type 'instance' is not iterable
为什么会这样?我认为这两个变量都是字符串。。。在
以下是模块代码:
^{pr2}$这是我的应用程序代码:
import tkMessageBox
from Tkinter import *
import loginutility as lu
root=Tk()
def check():
if logbox.check() == True:
tkMessageBox.showinfo("Success", "Good job!")
users=lu.UserList()
regbox=lu.RegisterBox(root)
Button(root, text="Register", command=lambda: regbox.check(users)).grid()
logbox=lu.LoginBox(root)
Button(root, text="Login", command=check).grid()
root.mainloop()
您可以在
RegisterBox
和LoginBox
中以不同的方式检查用户和登录。在userlist
不是普通字典,而是类UserList
,必须在LoginBox.check()
中使用userlist.users
和{-
顺便说一句:你可以创建
UserList.check(user,password)
相关问题 更多 >
编程相关推荐