title: Is there a way to make this Python Tkinter function display numbers with some kind of delay effect?
body: <p>I'm developing a simple Python GUI app to solve sudokus using Tkinter. My problem currently is that I've tried apparently all possible ways to add a little delay to the displaying of the solving numbers while the backtracking algorithm finds them, so as to get a visual effect on the grid (just like <a href="https://upload.wikimedia.org/wikipedia/commons/8/8c/Sudoku_solved_by_bactracking.gif" rel="nofollow noreferrer">here</a>).</p>
  <p>Here is the code:</p>
  <pre><code>#F to solve puzzle
  def solve_sudoku():
      find = find_empty()
      if not find_empty():
          return True
      else:
          x, y = find
      for num in range(1, 10):
          if validate_cell(x, y, num):
              sudoku[x][y].delete(0, &quot;end&quot;)
              sudoku[x][y].insert(0, str(num))
              sudoku[x][y].config(fg = &quot;SpringGreen3&quot;)
              #===&gt; here goes the delay &lt;===
              if solve_sudoku():
                  return True
              sudoku[x][y].delete(0, &quot;end&quot;)   
      return False
  </code></pre>
  <p>Now, <code>.sleep()</code> of course doesn't work because it affects the whole GUI. I've noticed that the only thing which seems to work somehow is the <code>messagebox</code> widget, but that's not the proper way to deal with it. I've tried also with other widgets, such as hiding some microlabel, but to no avail. What could possibly work?</p>
  <p>EDIT1: tried as well with the <code>.after()</code> method but couldn't get anything good out of it.</p>
  <p>EDIT2: <code>sudoku[][]</code> is a list of lists of Entry objects.</p>
  <p>EDIT3: <a href="https://pastebin.com/z3JVsHGc" rel="nofollow noreferrer">here</a> you can find a quick very minimal reproducible example of the program.</p>