zoukankan      html  css  js  c++  java
  • 使用easygui简单图形化界面库模拟用户登录和注册-董老师(peter)

    import easygui

    #声明变量username和password存储原来的账号与密码

    username='nnmm'

    password='20071119'

    #账号注册(输入账号,可以为新账号,也可以是已注册账号)

    username1=easygui.enterbox('请输入您的账号:')

    #声明变量bool1与bool2并赋值为True和False

    bool1=True

    bool2=False

    #当bool1为True时,执行while循环语句,否则跳出while循环

    while bool1:

        if username1!=username:

            easygui.msgbox('您的账号还未注册!')

        #ccbox()方法用于两种情况的选择

            result=easygui.ccbox('这里是注册页面','是否同意注册',('是','否'))

            if result==True:

                easygui.msgbox('欢迎来到注册页面')

                username1=easygui.enterbox('请输入您所要注册的账号:')

                username=username1

                #输入验证码验证

                code=easygui.enterbox('请输入手机验证码:')

                password1=easygui.enterbox('请设置新密码:')

                password=password1

                easygui.msgbox('注册成功,请直接登录!')

                username1=easygui.enterbox('请输入已注册账号:')

                bool=True

        #当bool或者bool2为True时,请输入密码

        while bool or bool2:

            password1=easygui.enterbox('请输入密码:')

            if username1==username and password1==password:

                easygui.msgbox('欢迎来到购物系统,祝您购物愉快!')

                bool=False

                bool1=False

                bool2=False

            else:

                easygui.msgbox('您的账号或密码输入错误!')

                username1=easygui.enterbox('请输入已注册的账号:')

            if bool==False and bool1==False and bool2==False:                     

                equipment=easygui.choicebox('选择你要的装备','装备购买',('冷静之靴','极寒风暴','暗影战斧','无尽之刃','名刀司命'))

                price=int(easygui.enterbox('请输入产品单价:'))

                num=int(easygui.enterbox('请输入你购买的数量:'))

                sum=price*num

                #逻辑判断,买卖规则

                money='本次购物需要'+str(sum)+'金币'

                if equipment=='冷静之靴':

                    easygui.msgbox(money)

                elif equipment=='极寒风暴':

                    easygui.msgbox(money)

                elif equipment=='暗影战斧':

                    easygui.msgbox(money)

                elif equipment=='无尽战刃':    

                    easygui.msgbox(money)

                elif equipment=='名刀司命':

                    easygui.msgbox(money)

                else:

                    easygui.msgbox('您输入的商品不存在!')

        if username1 == username and password1 == password:

            bool2 = True

                

  • 相关阅读:
    远程安装WinXP OEM版系统的痛苦经历
    许可证服务因许可证不够出现占用CPU的故障
    AvayaP133G2和3Com 3300交换机间的Vlan连接
    从win2000升级到win2003后ISA2000缓存的问题
    大型局域网中用ISA隔离部分计算机
    ORACLE学习第二天
    ORACLE ROWID解析
    ORA32773问题解决
    ORACLE学习第三天
    ORACLE表空间迁移
  • 原文地址:https://www.cnblogs.com/dongks/p/11831838.html
Copyright © 2011-2022 走看看