I\'m currently learning the Tkinter GUI programming. And I\'m stuck in somewhere in multi threading concept. Even though this topic is discussed several times here, I couldn
You don't need threading for something this simple.
The GUI is freezing because you're putting a time.sleep inside the function which is blocking the main thread until it's finished.
Simply use Tk's built in after method. Change your function to.
def countNum(self, num=0):
if num < 10:
print num
root.after(2000, lambda: self.countNum(num + 1))
else:
print "Stopping after call"
The after method takes the following arguments:
after(delay_ms, callback, arguments)
The time is in milliseconds, and 1000 ms = 1 second. So, we pass 2,000 ms for a 2 second delay.