Sort Algorithm Visualization: How to pull values to animate the canvas, from inside a tight loop
问题 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