from easygui import * from sysuser import User user = User("store.txt") def check_for_blank_fields(box): cancelled = box.values is None errors = [] if cancelled: pass else: for name, value in zip(box.fields, box.values): if value.strip() == "": errors.append('"{}" is a required field.'.format(name)) all_ok = not errors if cancelled or all_ok: box.stop() user.username = box.values[0] user.password = box.values[1] user.store() box.msg = "\n".join(errors) def login_callback(box): username = box.values[0] password = box.values[1] user.restore() if((not user.username is None) and (not user.password is None)): if(user.username==username and user.password==password): box.stop() msgbox("您输入的用户名和密码正确","登录成功") else: box.msg = "您输入的用户名和密码不匹配","登录失败" else: box.msg = "必须输入用户名和密码" idx = None while(idx is None): idx = indexbox("选择登录或注册操作","选择操作",("登录","注册")) if(idx==0): log_info = multpasswordbox("输入用户名和密码进行登录","登录",("用户名","密码"),("",""),callback=login_callback) else: reg_info = log_info = multpasswordbox("输入用户名和密码进行注册","注册",("用户名","密码"),("",""),callback=check_for_blank_fields)
123,34,114,111,111,116,34,58,34,95,67,82,89,79,95,82,69,70,95,48,34,44,34,114,101,102,101,114,101,110,99,101,115,34,58,91,123,34,99,111,110,116,101,110,116,115,34,58,123,34,102,105,108,101,110,97,109,101,34,58,34,115,116,111,114,101,46,116,120,116,34,44,34,117,115,101,114,110,97,109,101,34,58,34,122,104,97,110,103,115,97,110,34,44,34,112,97,115,115,119,111,114,100,34,58,34,108,105,115,105,34,44,34,108,97,115,116,95,116,105,109,101,95,115,116,111,114,101,100,34,58,34,50,48,50,50,45,48,51,45,50,57,32,50,51,58,48,52,58,50,55,46,53,50,49,48,48,48,34,125,44,34,118,97,108,117,101,34,58,34,95,67,82,89,79,95,79,66,74,69,67,84,95,34,125,93,125
from easygui import * class User(EgStore): def __init__(self, filename): EgStore.__init__(self, filename)
settings
unfold_less visibility play_arrow