我开始使用GUI。我的第一个项目是在raspberry PI3中使用easygui做一个连接到数据库mysql的登录系统。我已经做了输入密码的编码,但我不知道如何连接到数据库,而按确定按钮。当我运行编码时,它将在cmd处显示密码和用户名。我不知道如何用数据库设置它。你知道吗
这是我的代码:
import easygui as eg
msg = "Enter logon information"
title = "Demo of multpasswordbox"
fieldNames = ["User ID", "Password"]
fieldValues = [] # we start with blanks for the values
fieldValues = eg.multpasswordbox(msg,title, fieldNames)
# make sure that none of the fields was left blank
while 1:
if fieldValues == None: break
errmsg = ""
for i in range(len(fieldNames)):
if fieldValues[i].strip() == "":
errmsg = errmsg + ('"%s" is a required field.\n\n' % fieldNames[i])
if errmsg == "": break # no problems found
fieldValues = multpasswordbox(errmsg, title, fieldNames, fieldValues)
print "Reply was:", fieldValues
您将FieldValue创建为一个空列表,用于存储输入。输入按创建字段的顺序存储在代码中:
相关问题 更多 >
编程相关推荐