Feb-21-2021, 02:55 PM
Hello. I a new to python and this forum. I am making a little game and I do not understand why but my GUI crashes after it completes the code or I want to close it. Can someone help?
from tkinter import * import random import tkinter import time def gamemain(): print("Once was a nice village. It lived in prosperity.") time.sleep(1) print("The village was attacked by witches. All village was insalved.") time.sleep(1) print("But you managed to survive. Witches deleted your memory with their magic.") time.sleep(1) PlayersName = input("What will you name your self? ") print("Ok " + PlayersName) time.sleep(1) print("Go and save your people. After all you were a... KING!") print("LEVEL 1") print("__________________________________________________________________________") print("You are checking the houses for survivors and you see 3 doors that magicly appered") doors = input("Which door are you going to open?") window = Tk() photo = PhotoImage(file="doors.jpg") label = Label(window, image=photo) label.pack() window.mainloop() def start1(): secCheck = input("Please show me your lisence mister:") if secCheck == "MonkeIsGreat": print("Lets begin!") command = gamemain() else: print("Sorry mister. I can not let you go.") def close(): exit() print("SIMPLICITY by NAPALM") window = Tk() window.geometry = "100X100" buttonA = Button(window, text="START", command=start1) buttonB = Button(window, text="CLOSE", command=close) buttonA.pack() buttonB.pack() window.mainloop() window.destroy()