我对python并不陌生,但也不擅长。我试图再次学习Tkinter,因为我完全忘记了它,但是我似乎被卡住了。您会看到我正在制作这个文字冒险游戏,每次您按下一个按钮时,它都应该root.withdraw()窗口并制作一个具有新文字的新游戏。当您单击一次时,此方法可以正常工作,但是第二次尝试时,则无济于事。
root1.withdraw()
police = Tk()
police.geometry('300x500')
l1 = Label(police, text='You called the police who arrived\n on the scene within minutes. When they arrived they thankes you for not touching the body.\nWhat you didnt tell them is that you had touched the body.')
l1.grid(column=0, row=0)
def clicked1():
root.withdraw()
root1 = Tk()
root1.geometry('300x500')
l1 = Label(root1,
text='You enter your house after school only to find your \nmum dead on the carpet. There is blood everywhere.')
l1.grid(column=0, row=0, pady=30)
l2 = Label(root1, text=' ')
l2.grid(column=0, row=1)
l3 = Label(root1, text='What should you do?', pady=0)
l3.grid(column=0, row=2)
b1 = Button(root1, text='Call the police.', command=lambda: b1_call)
b1.grid(column=0, row=3, pady=10)
b2 = Button(root1, text='Investigate on your own.')
b2.grid(column=0, row=4, pady=10)
b3 = Button(root1, text='Leave it alone')
b3.grid(column=0, row=5, pady=10)
b1 = Button(root1, text='Call the police.')
b1.grid(column=0, row=3, pady=10)
预先感谢, 乔什