PythonWin, python thread and PostQuitMessage?

arnaud at arnaud at
Thu Mar 12 10:21:35 CET 2009

Hi All,

I'm not so much involved in any Windows programming however I needed
to write a client for the Windows platform. I have this very simple
question which I've been unable to answer. I'm listening for keyboard
strokes using the pyhook library. I'm doing this in a dedicated
thread. The gui just controls the thread. When I want to pause
listening for keyboard strokes I wanted to do a PostQuitMessage() to
the thread. However this does not work since it either kills the whole
app or just does not happen in the thread it's supposed to. I've now
made an ugly workaround using PumpWaitingMessages and a delay.

def run(self):
	print "Wkeylog run called"
	# Hook Keyboard
	while self.log:

i can now just cancel the process by setting self.log to False. I
wanted to do just:

def run(self):
	print "Wkeylog run called"
	# Hook Keyboard

However I'm unable to stop this process. Can anyone shred al light



More information about the Python-list mailing list