Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Tkinter as tk
- from random import randint
- def randomchance():
- num = randint(1,100)
- if num <= 60:
- chance = 2
- elif num <= 90 and num > 60:
- chance = 3
- else:
- chance = 4
- def onClick():
- global cash, cashclick
- cash += cashclick
- totalcash.configure(text="Total Cash: $" + str(cash))
- def evolve():
- global cash, cashclick, chance
- toplevel = tk.Toplevel()
- confirmtxt = tk.Label(toplevel, text="Are you sure you want to evolve? You will lose all your progress, but money earned per click will increased either 2x, 3x, or 4x.", height = 0, width = 100)
- def notevolve():
- toplevel.destroy()
- def doevolve():
- global cash, cashclick, chance
- cash -= cash
- randomchance()
- cashclick *= chance
- totalcash.configure(text="Total Cash: $" + str(cash))
- toplevel.destroy()
- confirmA = tk.Button(toplevel, text="Yes Evolve", command=doevolve)
- confirmB = tk.Button(toplevel, text="Don't Evolve", command=notevolve)
- confirmtxt.pack()
- confirmA.pack(side = tk.LEFT)
- confirmB.pack(side = tk.LEFT)
- def destroywindow():
- root.destroy()
- chance = 1
- cash = 0
- cashclick = 100
- root = tk.Tk()
- root.title("Test")
- totalcash = tk.Label(text="Total Cash: $" + str(cash), fg = "green", font=('Arial',40))
- earncash = tk.Button(text="Work",command=onClick)
- quitgame = tk.Button(text="QUIT GAME.", fg = 'red',command=destroywindow)
- evolveB = tk.Button(text="Evolve",command=evolve)
- totalcash.pack()
- earncash.pack()
- evolveB.pack()
- quitgame.pack()
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement