Skip to content Skip to sidebar Skip to footer

Threading With Tkinter Bind And Canvas

I am having problems with Tkinter's canvas.coords() method. I am trying to update the canvas every 1/60 of a second and trying to detect when the Right arrow key is pressed. The pr

Solution 1:

Tkinter is not thread safe, and quite often threads simply aren't needed.

In your case you can use after to periodically ron something every N milliseconds. For example, to run something approximately 60 times per second you would do something like this:

defreal_time():
    <do something here>
    self.after(16, real_time)

Then, call this function once when your program starts up:

real_time()

Post a Comment for "Threading With Tkinter Bind And Canvas"