0

I did some code to remind myself how tkinter works and the problem is that I can't seem to figure out how to make a score count. I found something on the internet, but it won't work.

This is my code so far:

from tkinter import *
from tkinter.ttk import *

global counterr
counterr = 0
root = Tk()


def bump(label):
    global counterr
    counterr += 1
    label.config(text=counterr)


root.title('Le pizza peperoni')
root.geometry("300x400")
Piza = Label(root, text="EAT!", font="Helvetica 60 bold", foreground="red")
Piza.pack(side="top")
counter = Label(root, font="Helvetica 40", foreground="black")
counter.pack()
photo = PhotoImage(file=r"Pepizza.png")
photoimage = photo.subsample(4, 4)
Eatbutton = Button(root, image=photoimage, command=bump(counter))
Eatbutton.pack(side="top")
root.mainloop()

There is no error, but once you run the module the label "counter" will start with one and the button won't work.

Please tell me if you need more information.

0 Answers0