Comments are moderated. It may take a few minutes before your comment appears.
Markdown is supported in your comments.
My apologies that none of this code is directly useful in the copy/paste sense. GUI libs require a stupid amount of distracting line noise. Anyway, now you know how to roll your own mainloop even when conventional wisdom says you can't.