I am trying to program a game that will change screens when the user presses the button. I want to use the 'count' variable to trigger an if statement that will delete everything on the page and create the next screen, but my if statement will not recognize the change in value of 'count' after the button is pressed. I'm using tkinter because this is the only module that I'm familiar with, I'm very new to coding. I tried using a while loop as well instead of the if statement as well, but that did not work. My goal with using the if statement is so that I don't have to program the rest of everything inside the function of the first button. I'm hoping to code it somewhat linearly so that it can be easy to manage for myself. If anybody knows how to refresh the variable for the statement or use a different type of statement that would work then that would be very helpful. I currently am using these modules in this program: tkinter, time, and os. Thank you!
count=0
#ALLOWS THE CONDITION TO BE MET TO MOVE SCREENS
def addCount():
global count
count+=1
print(count)
#EXITS PROGRAM
def exitpls(*exitB):
root.destroy()
#CREATE WINDOW
root = Tk()
root.title(";)")
root.config(bg="white")
#CREATE FRAME
frame = Frame(root, bg="white")
frame.pack(anchor=CENTER, side=BOTTOM, pady=15, expand=1)
#SIZE WINDOW
w, h = root.winfo_screenwidth(), root.winfo_screenheight()
#window.overrideredirect(1) #ENABLE TO GO FULLSCREEN
root.geometry("%dx%d+0+0" % (w, h))
root.bind("<Escape>", exitpls)
# !FIRST SCREEN! Intro
introImagePath = "us.gif"
introImage = PhotoImage(file=introImagePath)
introImageLabel = Label(frame, image=introImage)
introImageLabel.grid(row=0, column=0, sticky=N, pady=10)
introLabel = Label(frame, text=introMessage, font="none 25", width=54, height=6, relief="sunken")
introLabel.grid(row=1, column=0, sticky=N, pady=10)
introButton = Button(frame, width=32, command=addCount, text="R E A D Y", font="none 40 bold", relief="raised")
introButton.grid(row=2, column=0, sticky=S, pady=10)
while count == 1:
introImageLabel.grid_forget()
introLabel.grid_forget()
introButton.grid_forget()
break
root.mainloop()