Advertisement
pixelhd

help

May 5th, 2016
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. import Tkinter as tk
  2. from random import randint
  3.  
  4. def randomchance():
  5. num = randint(1,100)
  6. if num <= 60:
  7. chance = 2
  8. elif num <= 90 and num > 60:
  9. chance = 3
  10. else:
  11. chance = 4
  12.  
  13. def onClick():
  14. global cash, cashclick
  15. cash += cashclick
  16. totalcash.configure(text="Total Cash: $" + str(cash))
  17. def evolve():
  18. global cash, cashclick, chance
  19. toplevel = tk.Toplevel()
  20. 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)
  21. def notevolve():
  22. toplevel.destroy()
  23. def doevolve():
  24. global cash, cashclick, chance
  25. cash -= cash
  26. randomchance()
  27. cashclick *= chance
  28. totalcash.configure(text="Total Cash: $" + str(cash))
  29. toplevel.destroy()
  30.  
  31. confirmA = tk.Button(toplevel, text="Yes Evolve", command=doevolve)
  32. confirmB = tk.Button(toplevel, text="Don't Evolve", command=notevolve)
  33. confirmtxt.pack()
  34. confirmA.pack(side = tk.LEFT)
  35. confirmB.pack(side = tk.LEFT)
  36. def destroywindow():
  37. root.destroy()
  38.  
  39. chance = 1
  40. cash = 0
  41. cashclick = 100
  42. root = tk.Tk()
  43.  
  44. root.title("Test")
  45.  
  46. totalcash = tk.Label(text="Total Cash: $" + str(cash), fg = "green", font=('Arial',40))
  47. earncash = tk.Button(text="Work",command=onClick)
  48. quitgame = tk.Button(text="QUIT GAME.", fg = 'red',command=destroywindow)
  49. evolveB = tk.Button(text="Evolve",command=evolve)
  50.  
  51. totalcash.pack()
  52. earncash.pack()
  53. evolveB.pack()
  54. quitgame.pack()
  55. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement