import easygui
# Declare variables username and password stored in the original account and password
username='nnmm'
password='20071119'
# Account registration (enter the account number, which can be a new account, it can be registered account)
username1 = easygui.enterbox ( 'Please enter your account number:')
# Declare variables and assign bool1 and bool2 True and False
bool1=True
bool2=False
# When bool1 is True, execution while loop, or jump out of the while loop
while bool1:
if username1!=username:
easygui.msgbox ( 'Your account has not been registered!')
Select #ccbox () method for both cases
result = easygui.ccbox ( 'Here is the registration page', 'agree that registration' ( 'Yes', 'No'))
if result==True:
easygui.msgbox ( 'Welcome to the registration page')
username1 = easygui.enterbox ( 'Please enter the account number you want to register:')
username=username1
# Input CAPTCHA
code = easygui.enterbox ( 'Enter phone code:')
password1 = easygui.enterbox ( 'Please set a new password:')
password=password1
easygui.msgbox ( 'registered, please login directly!')
username1 = easygui.enterbox ( 'Please enter already registered account:')
bool=True
# When bool or bool2 is True, enter the password
while bool or bool2:
password1 = easygui.enterbox ( 'Enter password:')
if username1==username and password1==password:
easygui.msgbox ( 'Welcome to the shopping system, I wish you a happy shopping!')
bool=False
bool1 = False
bool2=False
else:
easygui.msgbox ( 'your account or password input error!')
username1 = easygui.enterbox ( 'Please enter the registered account:')
if bool==False and bool1==False and bool2==False:
equipment = easygui.choicebox ( 'select the equipment you want', 'equipment purchase', ( 'calm Boots', 'arctic storm', 'Shadow Tomahawk', 'Infinity Blade', 'Mito Siming') )
price = int (easygui.enterbox ( 'Enter Unit Price:'))
num = int (easygui.enterbox ( 'Please enter the quantity you buy:'))
sum=price*num
# Logic, trading rules
money = 'The cart needs' + str (sum) + 'Gold'
if equipment == 'calm Boots':
easygui.msgbox(money)
elif equipment == 'arctic storm':
easygui.msgbox(money)
elif equipment == 'Shadow Tomahawk:
easygui.msgbox(money)
elif equipment == 'Endless War Edge':
easygui.msgbox(money)
elif equipment == 'Mito Siming':
easygui.msgbox(money)
else:
easygui.msgbox ( 'you entered does not exist merchandise!')
if username1 == username and password1 == password:
bool2 = True