[python]代码库
import time
import ybc_box
import ybc_ui
# 列表
print('python启动中...')
time.sleep(1.0)
c = []
l = ['蛋糕','红烧李中男' ,'烧烤','火锅' ,'麻辣烫','炕土豆','红烧茄子','四川麻辣面','李中男鸡汤','黑米粥' ,'毒鸡汤','可乐','美年达','肥肠','菠萝啤','红牛','二锅头','凉面','豆奶','爆炒李中男鸡','李中男烧烤','红牛']
# 价格
j = 0
p = {'李中男鸡汤':45.78,'烧烤李中男':5.0,'蛋糕':10.8,'红烧李中男':45.78,'烧烤':13.8,'火锅':123.0,'麻辣烫':56.2,'炕土豆':9.0,'红烧茄子':24.0,'四川麻辣面':37.0,'毒鸡汤':48.0,'黑米粥':5.0,'可乐':3.0,'美年达':4.0,'肥肠':43.50,'菠萝啤':7.0,'二锅头':80.0,'红牛':5.0,'凉面':20.0,'豆奶':2.5,'李中男烧烤':0.00,'爆炒李中男鸡':20.0}
an = ['点菜','结账','查看已点菜','替换菜']
def diancai():
print('点菜程序启动中...')
time.sleep(2.0)
while True:
b = ''
j = 0
print('这是本店的菜品','\n', l)
print('======================')
a = ybc_box.choicebox('请选择功能',an)
print(a)
if a == '点菜':
print('======================')
b = ybc_ui.input('输入想吃的菜品')
if b in l:
c.append(b)
else:
ybc_ui.message('没有这道菜~')
elif a == '结账':
print('======================')
ybc_box.msgbox('已经点了' + str(c))
for i in c:
j = j + p[i]
ybc_box.message('价格是:' + str(j) + '元')
print('再见~~')
break
elif a == '查看已点菜':
ybc_ui.message('您已经点了',c)
elif a == '替换菜':
b = ybc_ui.input('输入要替换的菜品')
if b in c:
g = ybc_ui.input('输入新菜品')
d = c.index(b)
c[d] = g
ybc_ui.message('你已经点的菜是:', c)
else:
ybc_ui.message('没有这道菜,你已经点的菜品是:',c)
else:
ybc_ui.message('输入错误!')
def tiaoshi():
i = 0
while 1:
if i < 3:
res = {'guest':'123'}
info = ybc_box.multpasswordbox('请输入账号密码',['账号','密码'])
name = info[0]
pwd = info[1]
if name in res:
ybc_box.msgbox('账号正确,确认密码...')
time.sleep(3.0)
if pwd == res[name]:
ybc_box.msgbox('密码正确,登录成功')
print('调试启动中...')
print('================')
print('1.换菜')
print('功能陆续开发中...')
print('================')
s = input('选项:')
if s =='1':
print(l)
b = input('输入要替换的菜品')
if b in l:
g = input('输入新菜品')
d = l.index(b)
l[d] = g
print(l)
else :
ybc_box.msgbox('密码错误,请重新输入')
else:
ybc_box.msgbox('账号错误,请输入正确账号')
i = i + 1
while True:
sk = input('输入功能:1点菜2.调试3.退出')
if sk == '1':
diancai()
elif sk == '2':
tiaoshi()
elif sk == '3':
break
else:
print('输入错误!')