Feb-18-2019, 06:48 AM
Good Day, i'm making a game for python. I have a loading screen and then I have a lobby where you choose the character. When a character is picked it's supposed to set the character value to the character number and erase all the button, currently only one. The problem is the button is not erased when pressed on. It's stumped me for awhile so I came here. I hope it's no just some simple spelling error. Thanks in Advance!
from tkinter import * #Variables tk = Tk() money = 0 score = 0 startvariable = 0 CharacterVariable = 0 ShotonButton = Button() #Images BGImage = PhotoImage(file='C:/Users/Chadd/Downloads/Background.gif') ShotonImage = PhotoImage(file='C:/Users/Chadd/Pictures/Converted/Converted/Official Shoton.gif') #Classes def StartUpSprites(): class StartingSprites(): class Shoton(): ShotonButton = Button(tk, text="", command=startgame(1), font=('Times', 50), bg='red', foreground='blue') Shoton = ShotonButton Shoton.config(image=ShotonImage, width=130, height=200 ) Shoton.pack() Shoton.place(relx=.1, rely=.1, anchor='nw') def StartUpItems(): class StartingItems(): pass def StartUpBG(): class FightingBG(): canvas.create_image(0, 0, anchor=NW, image=BGImage) #Canvas Creator canvas = Canvas(tk, width=800, height=800, bg='white') canvas.pack() StartUpBG() #Functions def startscreen(): canvas.delete('all') startbtn.destroy() StartUpBG() StartUpSprites() StartUpItems() startvariable = 1 def findCharacter(): if CharacterVariable == 1: print("Chungus") def startgame(character): ShotonButton.destroy() CharacterVariable = character findCharacter() #Buttons startbtn = Button(tk, text="Start Game", command=startscreen, font=('Times', 50), bg='red', foreground='blue') startbtn.pack() startbtn.place(relx=.5, rely=.8, anchor="c") #Canvas Text/Images GunnerText = canvas.create_text(400, 300, text='The Gunner', fill='red', font=('Times', 100))