[PYTHONMAC-SIG] apps freeze unless they print!
Steven D. Majewski
sdm7g@Virginia.EDU
Mon, 19 May 1997 12:46:23 -0400 (EDT)
On Sun, 18 May 1997, Joseph J. Strout wrote:
> I'm suddenly finding that Python locks up under the following conditions: I
> have a program in a loop which is working very hard (or snoozing) for a
> long time without printing anything to the console window (sample code
> below); I switch to the Finder or any other app; then I switch back --
> presto, it's frozen. By "frozen" I mean that the window is not refreshed,
> I can't move it, and I can't switch back to the Finder or any other app; I
> have to hit command-period or kill the Python process.
>
> Perhaps the Mac guts are only being updated whenever the console window is
> updated. But I don't really want to clutter up my nice log window with
> useless garbage (and system.out.write('') doesn't work either, I tried
> it!). Is there any other way to trigger the Mac event-handling parts?
>
Add the following line to the loop (plus an import MacOS, Evt somewhere):
MacOS.HandleEvent(Evt.GetNextEvent(-1)[1])
You get a delay on the screen update from the sleep.
I'm not sure why you get the lockup in the first place, but I
sometimes see the event effects get done right after I command-dot
out, so I expect it has something to do with the event queue.
---| Steven D. Majewski (804-982-0831) <sdm7g@Virginia.EDU> |---
---| Department of Molecular Physiology and Biological Physics |---
---| University of Virginia Health Sciences Center |---
---| P.O. Box 10011 Charlottesville, VA 22906-0011 |---
By doing just a little every day, you can gradually
let the task completely overwhelm you.
_______________
PYTHONMAC-SIG - SIG on Python for the Apple Macintosh
send messages to: pythonmac-sig@python.org
administrivia to: pythonmac-sig-request@python.org
_______________