V
Ville M. Vainio
Background: PyOS_InputHook is something that gets run when python is
doing raw_input. TkInter and friends use it to run their event loops,
so that their events are handled while python is doing raw_input.
What I'd like to do is run the same function without having to do
raw_input. I.e. I'd like to run whatever event loop is available,
without incorporating any gui-specific code (PyOS_InputHook seems like
a nifty way to accomplish this).
My actual use case is to keep a tkinter application responsive while
launching a background process (and waiting for it to complete!).
My eventual code would be something like:
launch_process_in_thread('bzr pull')
while not is_done:
pyos_inputhook()
time.sleep(0.1)
print "Done!"
doing raw_input. TkInter and friends use it to run their event loops,
so that their events are handled while python is doing raw_input.
What I'd like to do is run the same function without having to do
raw_input. I.e. I'd like to run whatever event loop is available,
without incorporating any gui-specific code (PyOS_InputHook seems like
a nifty way to accomplish this).
My actual use case is to keep a tkinter application responsive while
launching a background process (and waiting for it to complete!).
My eventual code would be something like:
launch_process_in_thread('bzr pull')
while not is_done:
pyos_inputhook()
time.sleep(0.1)
print "Done!"