Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- def MineCoins(event):
- label.coins+=label.coef
- label["text"] = "Coins:"+str(label.coins)
- def Upgrade(event):
- v=upgradeCoef.get()
- if(v== 1 and label.coins-10>=0):
- label.coef+=1
- label.coins-=10
- elif(v==10 and label.coins-100>=0):
- label.coef+=10
- label.coins-=100
- elif(v==100 and label.coins-1000>=0):
- label.coef+=100
- label.coins-=1000
- label["text"] = "Coins:"+str(label.coins)
- window = Tk()
- window.title("CoinsClicker")
- window.geometry('500x400+300+200')
- label=Label(window,text="Coins:0")
- label.coins=0
- label.coef=1
- label.pack()
- mineButton = Button(window,text="MINE!",height="2")
- mineButton.bind("<Button-1>",MineCoins)
- mineButton.pack()
- upgradeButton=Button(window,text="UPGRADE!",height="2")
- upgradeButton.bind("<Button-1>",Upgrade)
- upgradeButton.pack()
- upgradeCoef=IntVar()
- radioButton1=Radiobutton(window,text="x1",variable=upgradeCoef,value=1)
- radioButton2=Radiobutton(window,text="x10",variable=upgradeCoef,value=10)
- radioButton3=Radiobutton(window,text="x100",variable=upgradeCoef,value=100)
- radioButton1.pack()
- radioButton2.pack()
- radioButton3.pack()
- window.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement