exit on key

This commit is contained in:
Göktuğ Karakaşlı
2019-12-07 14:30:18 +03:00
parent 268f4d0c90
commit d019e416ba
53 changed files with 114 additions and 7 deletions

View File

@@ -193,6 +193,8 @@ def astar_torus(grid, start_node, goal_node):
for i in range(1, len(route)):
grid[route[i]] = 6
plt.cla()
plt.gcf().canvas.mpl_connect('key_release_event',
lambda event: [exit(0) if event.key == 'escape' else None])
plt.imshow(grid, cmap=cmap, norm=norm, interpolation=None)
plt.show()
plt.pause(1e-2)