the “win” and “lose” windows aren’t popping up, this is only part of the code. I think I should put in one of the labels but I’m not sure
#Create the pet window
def open_petwindow():
#create pet window
pet_window = tkinter.Toplevel()
#name pet window
pet_window.title("PET WINDOW")
#change bg
pet_window.configure(bg = "white")
#change size
pet_window.geometry("300x350")
#create frames
top_frame2 = tkinter.Frame(pet_window, bg = "white")
middle_frame2 = tkinter.Frame(pet_window, relief='groove',bd=5, bg = "white")
bottom_frame2 = tkinter.Frame(pet_window, relief='groove',bd=5, bg = "white")
bottomest_frame = tkinter.Frame(pet_window, relief='groove',bd=5, bg = "white")
#pack frames
top_frame2.pack(pady=(35,20))
middle_frame2.pack()
bottom_frame2.pack()
bottomest_frame.pack()
#create top frame widgets
#create a string var
value = tkinter.StringVar()
#create name display widget
name_display = tkinter.Label(top_frame2, textvariable=value, bg = "chocolate4", fg = "white"\
, font = ("Yu Gothic UI Semilight", 10))
#set value and get name
value.set(name_entry.get())
#pack name display
name_display.pack(side = "top")
#create pet widget
pet = tkinter.Label(top_frame2, text = """\
___ _
o ' ' ) } ____ / /
` __ / )
( _ ( _ / - ( _ /
""", fg = "chocolate4", bg = "white", font = ("Helvetica 18 bold", 15))
#pack pet widget
pet.pack()
#create middle frame widgets
#create starting health
global happiness
happiness = 30
#create starting happiness
global health
health = 30
#def happiness action
def happiness_action():
global health
global happiness
happiness = happiness + 10
health = health - 5
healthvar.set(str(health))
happinessvar.set(str(happiness))
#def health action
def health_action():
global health
global happiness
health = health + 10
happiness = happiness - 5
healthvar.set(str(health))
happinessvar.set(str(happiness))
#create action buttons
water = tkinter.Button(middle_frame2, text = "water", bg = "lightskyblue3", \
command = happiness_action, font = ("Yu Gothic UI Semilight", 10))
feed = tkinter.Button(middle_frame2, text = "feed", bg = "pink", \
command = health_action, font = ("Yu Gothic UI Semilight", 10))
play = tkinter.Button(middle_frame2, text = "play", bg = "lightskyblue3", \
command = happiness_action, font = ("Yu Gothic UI Semilight", 10))
medicine = tkinter.Button(middle_frame2, text = "medcine", bg = "pink", \
command = health_action, font = ("Yu Gothic UI Semilight", 10))
#pack action buttons
water.pack(side = "left")
feed.pack(side = "left")
play.pack(side = "left")
medicine.pack(side = "left")
#create bottom widgets
while happiness > 10 and health > 10:
#create the string variables
healthvar=tkinter.StringVar()
happinessvar=tkinter.StringVar()
#set vars
healthvar.set(str(health))
happinessvar.set(str(happiness))
#create health display widget
health_display = tkinter.Label(bottom_frame2, text = "health:", bg = "white"\
, font = ("Yu Gothic UI Semilight", 10))
health_displayvar=tkinter.Label(bottom_frame2,textvariable=healthvar, \
font = ("Yu Gothic UI Semilight", 10), bg = "pink")
#create happiness display widget
happiness_display = tkinter.Label(bottom_frame2, text = "happiness:", bg = "white"\
, font = ("Yu Gothic UI Semilight", 10))
happiness_displayvar=tkinter.Label(bottom_frame2,textvariable=happinessvar, \
font = ("Yu Gothic UI Semilight", 10), bg = "lightskyblue3")
#pack health display
health_display.pack(side = "left")
health_displayvar.pack(side='left')
#pack happiness display
happiness_display.pack(side = "left")
happiness_displayvar.pack(side='left')
#create win window
#create if statement
if health >= 50 and happiness >= 50:
#create new window
win_window = tkinter.Toplevel()
#name window
win_window.title("WIN WINDOW")
#change colour
win_window.configure(bg = "white")
#create frames
top_frame3 = tkinter.Frame(win_window, relief='groove',bd=5, bg = "white")
middle_frame3 = tkinter.Frame(win_window, relief='groove',bd=5, bg = "white")
bottom_frame3 = tkinter.Frame(win_window, relief='groove',bd=5, bg = "white")
#pack frames
top_frame3.pack()
middle_frame3.pack()
bottom_frame3.pack()
#create top widgets
#create win desc widget
win_desc = tkinter.Label(top_frame3, text = "Congrats, you win! ▼^ᴥ^▼ \n Pick a prize")
#pack win desc
win_desc.pack(pady = (30,30))
#create middle widgets
#create radio var
prize_var = tkinter.IntVar()
#create prizes
dog_bone = tkinter.Radionbutton(middle_frame3, text = "dog bone", variable = radio_var)
dog_house = tkinter.Radionbutton(middle_frame3, text = "dog house", variable = radio_var)
dog_toys = tkinter.Radionbutton(middle_frame3, text = "dog toys", variable = radio_var)
#pack prizes
dog_bone.pack()
dog_house.pack()
dog_toys.pack()
#create bottom widgets
#def message box
def message_box():
tkinter.showinfo.messagebox('prize','congrats! you got', textvariable = radio_var)
#create confirm button
confirm_button2 = tkinter.Button(bottom_frame3, text = "confirm!", command = message_box\
, bg = "white", font = ("Yu Gothic UI Semilight", 10))
#pack confirm button
confirm_button2.pack()
#create quit button
quit_button3 = tkinter.Button(bottom_frame3, text = "quit", command = intro_window.destroy\
and pet_window.destroy and win_window.destroy, bg = "white", \
font = ("Yu Gothic UI Semilight", 10))
#pack quit button
quit_button3.pack()
#create lose window
#create if statement
if health <= 10 or happiness <= 10:
#create new window
lose_window = tkinter.Toplevel
#name window
lose_window.title("LOSE WINDOW")
#change colour
lose_window.configure(bg = "white")
#create frames
top_frame4 = tkinter.Frame(lose_window, relief='groove',bd=5, bg = "white")
bottom_frame4 = tkinter.Frame(lose_window, relief='groove',bd=5, bg = "white")
#pack frames
top_frame4.pack()
bottom_frame4.pack()
#create top widgets
#create lose desc widget
lose_desc = tkinter.Label(top_frame4, text = "Sorry, you lose! ▼ˣᴥˣ▼ \n You'd be a bad pet owner :(")
#pack lose desc
lose_desc.pack(pady = (30,30))
#create bottom widets
#create retry button
retry_button = tkinter.Button(bottom_frame4, command = intro_window, bg = "white", \
font = ("Yu Gothic UI Semilight", 10))
#pack retry button
retry_button.pack()
#create quit button
quit_button4 = tkinter.Button(bottom_frame4, command = intro_window.destroy and pet_window.destroy\
and lose_window.destroy, bg = "white", font = ("Yu Gothic UI Semilight", 10))
#pack quit button
quit_button4.pack()