This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: TkInter won't update display on OS X if delay is too small
Type: Stage: resolved
Components: Tkinter Versions: Python 2.7
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: Leon.Maurer, ned.deily, ronaldoussoren
Priority: normal Keywords:

Created on 2013-01-12 05:24 by Leon.Maurer, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit Leon.Maurer, 2013-01-12 05:24
Messages (7)
msg179769 - (view) Author: Leon Maurer (Leon.Maurer) Date: 2013-01-12 05:24
I'm running in to a problem where TkInter won't update the display on OS X. I've attached a simple piece of code that has this problem, and I've also made a short screen-cast of the problem:

The program is simple -- basically a big canvas with a some text in the middle that counts up.

The screen-cast has three parts. First, it shows the program working as it should. Then, I add a simple background image to the canvas (a black rectangle), and the interface refuses to refresh at all; I get a spinning beach ball wheel (although that doesn't show up in the screen-cast). Then, I increase the delay between updates, and the interface refreshes as it should.

The middle case, where the interface becomes totally unresponsive, is a bug.

I haven't been able to reproduce this problem under Linux or Windows; I've only run in to it on OS X. Also, the size of the canvas and image matters; if I make them small enough, the interface won't freeze up.

Computer and software information:
OS X 10.6.8
Python 2.7.3
ActiveTcl 8.5.13
PIL 1.1.7
MacBookPro5,5 w/ 2.26GHz Core 2 Duo (so a machine that's kind of slow by today's standards -- maybe faster machines won't run in to this problem, but this machine doesn't have the problem when running Windows or Linux)
msg179772 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2013-01-12 06:13
Thanks for the thorough documentation.  If you haven't already, I would ask about the problem over on the Tkinter mailing list where people with heavy-duty Tkinter experience hang out.
msg179812 - (view) Author: Leon Maurer (Leon.Maurer) Date: 2013-01-12 15:28
That's a good idea; I'll shoot them a message.
msg179820 - (view) Author: Leon Maurer (Leon.Maurer) Date: 2013-01-12 16:26
Well, it looks like the problem is known and can't be fixed:

Oh well.
msg179832 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2013-01-12 21:24
Would it be possible, and sane, to enforce a minimal delay on OSX? That is, code that automaticly ensures that the delay has some minimal value. 

Or does the required delay depend on what you are doing?
msg179833 - (view) Author: Leon Maurer (Leon.Maurer) Date: 2013-01-12 21:44
It seems to depend on what you're doing. Plus, the delay I needed turned an already slow animation in to a slide show.

In this case, a better fix seems to be sticking a "root.update()" right before the "root.after". Then it works with no delay. However, apparently it's a little dangerous to use:

In my case, the only side effect seems to be that using the menu effectively pauses the simualtion.
msg179835 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2013-01-12 22:12
FWIW, on my newer 2.2Ghz i7-based MacBookPro, I can reproduce the problem but I see satisfactory results by setting the delay to just 10 rather than 100. So, it is likely that the minimum delay is system- and application- dependent.  Since there's not likely anything to be done here in Tkinter, I am going to close this issue.  Perhaps some day down the road, work being down now by Guido in PEP 3156 may provide a better way to integrate Python event loops with Tk's and Cocoa's.
Date User Action Args
2022-04-11 14:57:40adminsetgithub: 61145
2013-01-12 22:12:11ned.deilysetstatus: open -> closed
resolution: wont fix
messages: + msg179835

stage: resolved
2013-01-12 21:44:43Leon.Maurersetmessages: + msg179833
2013-01-12 21:24:31ronaldoussorensetnosy: + ronaldoussoren
messages: + msg179832
2013-01-12 16:26:48Leon.Maurersetmessages: + msg179820
2013-01-12 15:28:57Leon.Maurersetmessages: + msg179812
2013-01-12 06:13:49ned.deilysetnosy: + ned.deily
messages: + msg179772
2013-01-12 05:24:41Leon.Maurercreate