Can an event loop be interrupted?

I think I may have exceeded my limited Python knowledge. Here’s my problem, harkyman was looking for a gui for Blender People. You can see what I provided here:

I cannot seem to figure out how to provide him with his requirements for a toggle button:

When the toggle button is depressed, the only thing that will happen is that the Main script will run, over and over, until the button is unpressed. If you want to change settings, you untoggle, change them, then toggle it back.

The problem is once the event loop for the toggle button is started, nothing else can happen until it is complete. The only way to break out of this loop is a keyboard interrupt. Is there something I am missing?

harkyman - I finally replied to your pm, sorry for the delay.

nope that sounds pretty much right

until python is done executing no events are recieved

so, it becomes difficult to do things that animate in a python window or such because the user will not have a good way of stopping them.

Just saw this thread. I’ve been suspecting the same thing. Hmmm.

Thanks for looking into this part of things. I’ve got my hands full with the rest of the code.

I am using Python to render animations – this iis because
doing everything in Python simulation code, and needing
to synchronize this with frame output. My question is how
I can break out of a running Python script short of
ctrl-alt-del and removing the Blender task. I have tried
everything. I had hoped that ESC would work.

Bringing up the console (text window) and hitting Ctrl-X (maybe it’s Ctrl-C or Ctrl-Z) will stop your Python script.

Good news and bad news: I brough up the text/console window
and Ctrl-C does create a keyboard interrupt of the script, and it
stops. Ctrl-X and Ctrl-Z don’t stop the script. But then,
after stopping the script with Ctrl-C, Blender crashes.

This is on a Dell XPS 3.4Ghz running XP. I guess I should post
this to the developer’s site but I’ll wait a bit to see if there is
a solution. It would appear to be a bug?