Users_Search Users_Search
关注数: 5 粉丝数: 11 发帖数: 919 关注贴吧数: 56
彩蛋 import tkinter import tkinter.messagebox import random import time ############################# choukacishu=10 totkejin=0 ############################# def function(): global choukacishu if choukacishu>0: global number number=random.randint(0,100) abc=e.get() if number==0: tkinter.messagebox.showinfo("欧气爆棚","你抽到了S级卡!") elif number<=3: tkinter.messagebox.showinfo("小有欧气","你抽到了A级卡!") elif number<=11: tkinter.messagebox.showinfo("恭喜","你抽到了B级卡!") elif number<=26: tkinter.messagebox.showinfo("恭喜","你抽到了C级卡.") elif number<=56: tkinter.messagebox.showinfo("很遗憾","你抽到了D级卡.") else: tkinter.messagebox.showinfo("非气十足","你抽到了E级卡......") choukacishu=choukacishu-1 else: tkinter.messagebox.showwarning("提示","抽卡次数不足") e.set("你的剩余抽卡次数:"+str(choukacishu)) def function2(): global choukacishu if choukacishu>=9: cishu=10 s=a=b=c=d=f=0 while cishu>=1: global number number=random.randint(0,100) abc=e.get() if number==0: s=s+1 elif number<=3: a=a+1 elif number<=11: b=b+1 elif number<=26: c=c+1 elif number<=56: d=d+1 else: f=f+1 cishu=cishu-1 tkinter.messagebox.showinfo("10连抽结果","你抽到了"+str(s)+"张S级卡\n你抽到了"+str(a)+"张A级卡\n你抽到了"+str(b)+"张B级卡\n你抽到了"+str(c)+"张C级卡\n""你抽到了"+str(d)+"张D级卡\n你抽到了"+str(f)+"张E级卡\n") tkinter.messagebox.showinfo("10连抽结果","总分:"+str(s*10+a*8+b*6+c*4+d*2+f)+"分") choukacishu=choukacishu-9 else: tkinter.messagebox.showwarning("提示","抽卡次数不足") e.set("你的剩余抽卡次数:"+str(choukacishu)) def function3(): global choukacishu if choukacishu>=89: cishu=100 s=a=b=c=d=f=0 while cishu>=1: global number number=random.randint(0,100) abc=e.get() if number==0: s=s+1 elif number<=3: a=a+1 elif number<=11: b=b+1 elif number<=26: c=c+1 elif number<=56: d=d+1 else: f=f+1 cishu=cishu-1 tkinter.messagebox.showinfo("100连抽结果","你抽到了"+str(s)+"张S级卡\n你抽到了"+str(a)+"张A级卡\n你抽到了"+str(b)+"张B级卡\n你抽到了"+str(c)+"张C级卡\n""你抽到了"+str(d)+"张D级卡\n你抽到了"+str(f)+"张E级卡\n") tkinter.messagebox.showinfo("100连抽结果","总分:"+str(s*10+a*8+b*6+c*4+d*2+f)+"分") choukacishu=choukacishu-89 else: tkinter.messagebox.showwarning("提示","抽卡次数不足") e.set("你的剩余抽卡次数:"+str(choukacishu)) def function4(): exit() def function5(): tkinter.messagebox.showinfo("说明","模拟抽卡") def function6_1(): global e global e11 global choukacishu global totkejin randomInt=random.randint(1,11) if totkejin>=2000: randomInt=1 if randomInt==1: tkinter.messagebox.showwarning("发生未知错误","氪金失败") else: choukacishu=choukacishu+1 totkejin=totkejin+1 tkinter.messagebox.showinfo("谢谢您","氪金成功,您现在有"+str(choukacishu)+"次抽卡机会") e.set("你的剩余抽卡次数:"+str(choukacishu)) def function6_2(): global e global e11 global choukacishu global totkejin randomInt=random.randint(1,11) if totkejin>=2000: randomInt=1 if randomInt==1: tkinter.messagebox.showwarning("发生未知错误","氪金失败") else: choukacishu=choukacishu+6 totkejin=totkejin+5 tkinter.messagebox.showinfo("谢谢您","氪金成功,您现在有"+str(choukacishu)+"次抽卡机会") e.set("你的剩余抽卡次数:"+str(choukacishu)) def function6_3(): global e global e11 global choukacishu global totkejin randomInt=random.randint(1,11) if totkejin>=2000: randomInt=1 if randomInt==1: tkinter.messagebox.showwarning("发生未知错误","氪金失败") else: choukacishu=choukacishu+13 totkejin=totkejin+10 tkinter.messagebox.showinfo("谢谢您","氪金成功,您现在有"+str(choukacishu)+"次抽卡机会") e.set("你的剩余抽卡次数:"+str(choukacishu)) def function6_4(): global e global e11 global choukacishu global totkejin randomInt=random.randint(1,11) if totkejin>=2000: randomInt=1 if randomInt==1: tkinter.messagebox.showwarning("发生未知错误","氪金失败") else: choukacishu=choukacishu+66 totkejin=totkejin+50 tkinter.messagebox.showinfo("谢谢您","氪金成功,您现在有"+str(choukacishu)+"次抽卡机会") e.set("你的剩余抽卡次数:"+str(choukacishu)) def function6_5(): global e global e11 global choukacishu global totkejin randomInt=random.randint(1,11) if totkejin>=2000: randomInt=1 if randomInt==1: tkinter.messagebox.showwarning("发生未知错误","氪金失败") else: choukacishu=choukacishu+133 totkejin=totkejin+100 tkinter.messagebox.showinfo("谢谢您","氪金成功,您现在有"+str(choukacishu)+"次抽卡机会") e.set("你的剩余抽卡次数:"+str(choukacishu)) def function6_6(): global e global e11 global choukacishu global totkejin randomInt=random.randint(1,11) if totkejin>=2000: randomInt=1 if randomInt==1: tkinter.messagebox.showwarning("发生未知错误","氪金失败") else: choukacishu=choukacishu+666 totkejin=totkejin+500 tkinter.messagebox.showinfo("谢谢您","氪金成功,您现在有"+str(choukacishu)+"次抽卡机会") e.set("你的剩余抽卡次数:"+str(choukacishu)) def function6_7(): global totkejin totkejin=totkejin-1000 def function6(): global totkejin Window1=tkinter.Tk() Window1.title("氪金页面") Window1.geometry("300x220+900+300") Window1.resizable(False,False) button11 = tkinter.Button(Window1,text="氪1块钱",command=function6_1,width=10,height=2) button11.place(x=50,y=40) button12 = tkinter.Button(Window1,text="氪5块钱",command=function6_2,width=10,height=2) button12.place(x=150,y=40) button13 = tkinter.Button(Window1,text="氪10块钱",command=function6_3,width=10,height=2) button13.place(x=50,y=80) button14 = tkinter.Button(Window1,text="氪50块钱",command=function6_4,width=10,height=2) button14.place(x=150,y=80) button15 = tkinter.Button(Window1,text="氪100块钱",command=function6_5,width=10,height=2) button15.place(x=50,y=120) button16 = tkinter.Button(Window1,text="氪500块钱",command=function6_6,width=10,height=2) button16.place(x=150,y=120) button17 = tkinter.Button(Window1,text="",command=function6_7,width=1,height=1) button17.place(x=150,y=200) if totkejin==0: tkinter.messagebox.showinfo("氪金提示","您还没有氪金哦.") elif totkejin<=100: tkinter.messagebox.showinfo("氪金提示","您已经氪了"+str(totkejin)+"元钱.") elif totkejin<2000: tkinter.messagebox.showwarning("氪金提示","您已经氪了"+str(totkejin)+"元钱\n\n少量氪金,有益身心!") else: tkinter.messagebox.showwarning("氪金提示","您已经不能再氪金了......") ############################# mac=tkinter.Tk() mac.title("抽卡机器") mac.geometry("300x220+600+300") mac.resizable(False,False) ############################# button1 = tkinter.Button(mac,text="开始抽卡",command=function,width=10,height=2) button1.place(x=50,y=40) ############################# button2 = tkinter.Button(mac,text="10连抽",command=function2,width=10,height=2) button2.place(x=50,y=80) ############################# button3 = tkinter.Button(mac,text="100连抽",command=function3,width=10,height=2) button3.place(x=150,y=80) ############################# button4 = tkinter.Button(mac,text="Exit",command=function4,width=10,height=2) button4.place(x=150,y=40) ############################# button5 = tkinter.Button(mac,text="抽卡机器说明",command=function5,width=21,height=2) button5.place(x=50,y=120) ############################# button6 = tkinter.Button(mac,text="氪金",command=function6,width=21,height=2) button6.place(x=50,y=160) ############################# e=tkinter.Variable() entry = tkinter.Entry(mac,textvariable=e) entry.place(x=50,y=0) e.set("你的剩余抽卡次数:"+str(choukacishu)) Window1=tkinter.Tk() Window1.title("氪金页面") Window1.geometry("300x220+900+300") Window1.resizable(False,False) button11 = tkinter.Button(Window1,text="氪1块钱",command=function6_1,width=10,height=2) button11.place(x=50,y=40) button12 = tkinter.Button(Window1,text="氪5块钱",command=function6_2,width=10,height=2) button12.place(x=150,y=40) button13 = tkinter.Button(Window1,text="氪10块钱",command=function6_3,width=10,height=2) button13.place(x=50,y=80) button14 = tkinter.Button(Window1,text="氪50块钱",command=function6_4,width=10,height=2) button14.place(x=150,y=80) button15 = tkinter.Button(Window1,text="氪100块钱",command=function6_5,width=10,height=2) button15.place(x=50,y=120) button16 = tkinter.Button(Window1,text="氪500块钱",command=function6_6,width=10,height=2) button16.place(x=150,y=120) button17 = tkinter.Button(Window1,text="",command=function6_7,width=1,height=1) button17.place(x=150,y=200) #编译一下,彩蛋立刻有!
1 下一页