“instance”类型的字典错误参数不是iterab

2024-09-27 21:30:37 发布

您现在位置:Python中文网/ 问答频道 /正文

当我正在为一个用户创建一个字符串时,我正在尝试通过一个用户登录来注册一个用户,但我正在尝试通过两个字符串来注册这个模块:

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()

Tags: 模块字符串text用户importcheckbuttonroot
1条回答
网友
1楼 · 发布于 2024-09-27 21:30:37

您可以在RegisterBoxLoginBox中以不同的方式检查用户和登录。在

userlist不是普通字典,而是类UserList,必须在LoginBox.check()中使用userlist.users和{}。在

-

顺便说一句:你可以创建UserList.check(user,password)

相关问题 更多 >

    热门问题