Skip to content

Instantly share code, notes, and snippets.

@avaque
Created June 13, 2018 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avaque/a5fd47b896c8ff4e9e52d206994187ce to your computer and use it in GitHub Desktop.
Save avaque/a5fd47b896c8ff4e9e52d206994187ce to your computer and use it in GitHub Desktop.
Cookie clicker
import tkinter as tk
a=0
b=1
g=1
G=100
h=2
H=180
j=3
J=265
k=4
K=350
l=5
L=435
def clicc(a,b):
a=a+b
def boostie(x,y,z,c):
if(z>=c):
x=x+y
z=z-c
def shoppie():
root=tk.Tk()
frame=tk.Frame(root)
frame.pack()
boost1=tk.Button(frame,
text="Cookie stand: +1 cookies/click - 100",
command=boostie(b,g,a,G))
boost1.pack()
boost2=tk.Button(frame,
text="Grandma: +2 cookies/click - 180",
command=boostie(b,h,a,H))
boost2.pack()
boost3=tk.Button(frame,
text="Bakery: +3 cookies/click - 265",
command=boostie(b,j,a,J))
boost3.pack()
boost4=tk.Button(frame,
text="Factory: +4 cookies/click - 350",
command=boostie(b,k,a,K))
boost4.pack()
boost5=tk.Button(frame,
text="Corporation: +5 cookies/click - 435",
command=boostie(b,l,a,L))
boost5.pack()
root.mainloop()
def cookies(a):
print(a)
root = tk.Tk()
frame = tk.Frame(root)
frame.pack()
button = tk.Button(frame,
text="QUIT",
fg="red",
command=quit)
button.pack(side=tk.LEFT)
buttonzy = tk.Button(frame,
text=a,
fg="blue",
command=cookies(a))
buttonzy.pack(side=tk.LEFT)
slogan = tk.Button(frame,
text="Cookie click!",
command=clicc(a,b))
slogan.pack(side=tk.LEFT)
shop=tk.Button(frame,
text="Shop",
command=shoppie)
shop.pack(side=tk.RIGHT)
root.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment