command to close a window in tkinter does not work

Viewed 23

I am trying to make it so that when I click the Exit button it closes the whole program, but the exit function is not working.

My code:

while True:
# o Back do jogo
escolha = ['pedra', 'papel', 'tesoura']
esc_pc = random.choice(escolha)

# tela principal
jane = Tk()
jane.title('PPT')

texto_duvida = Label(jane, text='Você Deseja jogar?')

btn_sim = Button(jane, text='Sim', bg='#C0C0C0', activebackground='#363636', command=jogo)
btn_nao = Button(jane, text='Não', bg='#C0C0C0', activebackground='#363636', command=sair)

Function Sair:

def sair():
jane.destroy()
0 Answers
Related