algorithm-animation

Sort Algorithm Visualization: How to pull values to animate the canvas, from inside a tight loop

*爱你&永不变心* 提交于 2019-12-18 09:15:12
问题 I am working on a visualization of different sorting algorithms using the height of different bars with tkinter. I have been able to shuffle the bars and also sort them after some help. The problem I am having now is slowing the sorting of the bars down so it can be seen how each algorithm works. Here is what I have so far: import tkinter as tk import random def swap_two_pos(pos_0, pos_1): Bar1x1, _, Bar1x2, _ = canvas.coords(pos_0) Bar2x1, _, Bar2x2, _ = canvas.coords(pos_1) canvas.move(pos

Sort Algorithm Visualization: How to pull values to animate the canvas, from inside a tight loop

半城伤御伤魂 提交于 2019-12-13 02:54:14
问题 I am working on a visualization of different sorting algorithms using the height of different bars with tkinter. I have been able to shuffle the bars and also sort them after some help. The problem I am having now is slowing the sorting of the bars down so it can be seen how each algorithm works. Here is what I have so far: import tkinter as tk import random def swap_two_pos(pos_0, pos_1): Bar1x1, _, Bar1x2, _ = canvas.coords(pos_0) Bar2x1, _, Bar2x2, _ = canvas.coords(pos_1) canvas.move(pos