I'm beginning using GUI . My first project is to do login system that connected to database mysql using easygui in raspberry pi 3. I already do the coding for enter the password but I dont know how to connect it with database while press ok button. While I run the coding, it will be display the password and username at the cmd. I dont know how to set it with database.
This is my coding:
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