Help with Spacehandlers - or an on-screen event viewer

Hey - my goal here is to have an event viewer within Blender - probably as a separate window withing Blender but I’ll take what I can get. I’m going to be doing some demonstrations with Blender, and so I figure it’d be helpful if there’s an on-screen guide showing what commands I run.

So that got me looking for a way to monitor events using a Python script, which of course led to spacehandlers.

I copied the example spacehandler from the Blender docs - this thing:

# SPACEHANDLER.VIEW3D.EVENT

import Blender
from Blender import Draw
evt = Blender.event
return_it = False

if evt == Draw.LEFTMOUSE:
  print "Swallowing the left mouse button press"
elif evt == Draw.AKEY:
  print "Swallowing an 'a' character"
else:
  print "Let the 3D View itself process this event:", evt
  return_it = True

# if Blender should not process itself the passed event:
if not return_it: Blender.event = None

I saved it in my scripts directory, opened it in a Blender text editor window, then went back to 3-D view, selected view->space handler scripts and activated the script. However, the script never eats events as it’s supposed to - never prints anything as far as I can tell (the output should go to the terminal window from which I ran Blender, right?) In my attempt to figure out why this isn’t working I went looking for other spacehandler scripts to try - it seems all the ones listed on BlenderWiki are dead links, so I’m pretty much lost here.

At the moment I’m running Blender 2.43 on Windows XP. I don’t know if the platform is going to make a difference here but the machine I’ll be using for the demo is a Mac.

It works fine for me and I’m running the same set-up as you. But if you can wait a few hours (about 10 hours, I got to go to work now) I’ll post a script for you that does what you want to do, or at least I’ll try and see how far I’ll get.

Here you go:
http://bartius.crouch.googlepages.com/show_keys.blend

Hey, thanks! I’ll have to give it a try when I get home. I’m still having no luck making spacehandlers work on 2.4.3 on Windows - but I’ve at least established that they’re working on 2.4.2 on Mac…