win.bind("<Key>",menuKeys)
def menuKeys(event):
global canvas, canwidth, canheight, blockwidth, blockheight
if event.keysym == settings["keys"]["other"]["stop"]:
x,y = blockPoint("center")
x -= 6
y -= 3
for i in range(5):
for j in range(10):
Spot(x+j,y)
y += 1
Text(x+3.5,y-2,"[Y/N]",color="blue",size=2)
Text(x,y-5,"Are you sure you want",color="black",size=2)
Text(x,y-4,"to quit?",color="black",size=2)
win.bind("<Key>",stop)
def stop(event):
if event.keysym == settings["keys"]["prompt-keys"]["yes"]:
win.destroy()
elif event.keysym == settings["keys"]["prompt-keys"]["no"]:
x,y = blockPoint("center")
x -= 6
y -= 3
for i in range(5):
for j in range(10):
Spot(x+j,y,color="#232627",outline="#232627")
y += 1
win.unbind("<Key>",stop)
else:
win.bind("<Key>",stop)
A função menukeys, quando pressionada, chama a função parar. Ao pressionar "não", a área é apagada, mas não consigo pressionar "sair" novamente para fazer isso. Qual é o problema?