Advertisement
_fakeuser_

Coin miner

Sep 1st, 2018
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.21 KB | None | 0 0
  1. from tkinter import *
  2. def MineCoins(event):
  3.     label.coins+=label.coef
  4.     label["text"] = "Coins:"+str(label.coins)
  5. def Upgrade(event):
  6.     v=upgradeCoef.get()
  7.     if(v== 1 and label.coins-10>=0):  
  8.         label.coef+=1
  9.         label.coins-=10
  10.        
  11.     elif(v==10 and label.coins-100>=0):
  12.         label.coef+=10
  13.         label.coins-=100
  14.        
  15.     elif(v==100 and label.coins-1000>=0):
  16.         label.coef+=100
  17.         label.coins-=1000
  18.        
  19.  
  20.     label["text"] = "Coins:"+str(label.coins)
  21. window = Tk()
  22. window.title("CoinsClicker")
  23. window.geometry('500x400+300+200')
  24. label=Label(window,text="Coins:0")
  25. label.coins=0
  26. label.coef=1
  27.  
  28. label.pack()
  29. mineButton = Button(window,text="MINE!",height="2")
  30. mineButton.bind("<Button-1>",MineCoins)
  31. mineButton.pack()
  32. upgradeButton=Button(window,text="UPGRADE!",height="2")
  33. upgradeButton.bind("<Button-1>",Upgrade)
  34. upgradeButton.pack()
  35. upgradeCoef=IntVar()
  36. radioButton1=Radiobutton(window,text="x1",variable=upgradeCoef,value=1)
  37. radioButton2=Radiobutton(window,text="x10",variable=upgradeCoef,value=10)
  38. radioButton3=Radiobutton(window,text="x100",variable=upgradeCoef,value=100)
  39. radioButton1.pack()
  40. radioButton2.pack()
  41. radioButton3.pack()
  42. window.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement