import tkinter as tk class ClickerGame: def __init__(self, master): self.master = master self.master.title("Clicker Game") self.score = 0 self.click_value = 1 self.upgrade_cost = 10 self.create_widgets() def create_widgets(self): self.score_label = tk.Label(self.master, text="Score: 0") self.score_label.pack(pady=10) self.click_button = tk.Button(self.master, text="Click", command=self.click) self.click_button.pack(pady=10) self.upgrade_button = tk.Button(self.master, text=f"Buy Upgrade (+{self.click_value})", command=self.buy_upgrade) self.upgrade_button.pack(pady=10) def click(self): self.score += self.click_value self.update_score() def buy_upgrade(self): if self.score >= self.upgrade_cost: self.score -= self.upgrade_cost self.click_value += 1 self.upgrade_cost += 10 self.update_score() self.update_upgrade_button() def update_score(self): self.score_label.config(text=f"Score: {self.score}") def update_upgrade_button(self): self.upgrade_button.config(text=f"Buy Upgrade (+{self.click_value}) - Cost: {self.upgrade_cost}") if __name__ == "__main__": root = tk.Tk() game = ClickerGame(root) root.mainloop()