Hello I do a cookie clicker. When the code is runnig, i see the button but the cookie image doesn't appear on its. Also, when i click on the button, nothing is happening. Here is the script:
from tkinter import *
from tkinter import Button
marron = "#ce6242"
c_cookie = "#8c5945"
class Cookie_clicker:
def __init__(self):
self.score = None
self.cookie_button = None
self.root = Tk()
self.root.geometry("720x440")
self.root.config(background=marron)
self.nbr_click = 0
self.f1 = Frame(self.root, bg=marron, highlightthickness=0)
self.f1.pack()
self.create_w()
def command_button(self):
self.nbr_click += 1
self.maj_label_score()
def create_w(self):
self.create_cookie_button()
self.create_label_score()
def create_cookie_button(self):
width = 300
height = 300
image = PhotoImage(file="/home/noam/PycharmProjects/pythonProject/Images/cookie.png").zoom(10).subsample(5)
cookie_button = Button(self.f1, height=height, width=width, bg=marron, command=self.command_button())
cookie_button.config(image=image)
cookie_button.pack()
def create_label_score(self):
self.score = Label(self.f1, text="0 click", width=10)
self.score.pack()
def maj_label_score(self):
self.score = str(self.nbr_click), "click"
cooki = Cookie_clicker()
cooki.root.mainloop()```