I do something along those lines in Neqsus. <br><br>Here's what I do.<br><br>I have a spacehandler for the 3D window that uses the blender Registry to store a "changed" variable. The source for it is below. This handler is included in the main script and initialized upon the first execution of the script(by initialized, I mean copied into a blender text object). It's not currently possible to automatically enable the handler, so this is as close as I could get. 
<br><br><br><br>handler = """# SPACEHANDLER.VIEW3D.EVENT<br>#!BPY<br><br>import Blender<br><br>evt = Blender.event<br><br>if evt == Blender.Draw.RIGHTMOUSE or Blender.Draw.LEFTMOUSE:<br>    # on a right mouse click assume I've selected an object or unselected it
<br>    # simply set something in the registry to say "hey, something changed"<br>    changed = { "changed" : True }<br>    print "changed"<br>    Blender.Registry.SetKey("BtoR_Space", changed)
<br>    WinID = Blender.Registry.GetKey("BtoR_WinID")<br>    ID = WinID["ID"][0]<br>    Blender.Window.QAdd(ID, Blender.Draw.REDRAW, 0, 0)<br>"""<br><br>Breaking it down, this uses Blender.Window.QAdd
 to add a redraw event to the window ID identified by BtoR_WinID. This is the ID of the blender script window...this variable is stuffed into the registry by the primary script(not the script handler). That's done like this:
<br><br>        # setup the spaceHandler window ID<br>        reg = { "ID" : [Blender.Window.GetAreaID()] }<br>        Blender.Registry.SetKey("BtoR_WinID", reg)<br><br>Yell if you need further info.<br>
<br>Bobby AKA ShortWave<br><a href="mailto:sh0rtwave@gmail.com">sh0rtwave@gmail.com</a><br><br><br><br><br><br><br><br><br><br><div><span class="gmail_quote">On 12/3/06, <b class="gmail_sendername">Joel Leineweber</b> <
<a href="mailto:jleineweber@gmail.com">jleineweber@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><span class="gmail_quote">
</span>I recently brought this up <a href="http://blenderartists.org/forum/showthread.php?t=83542" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">here on blenderartists</a>
, and <a href="http://blenderartists.org/forum/member.php?u=6112" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">ideasman42</a> suggested I email this list for a request.
<br><br>I basically want a way to redraw my script gui every time the user changes the selected object. Even if scriptlinks had this event, they don't allow Draw.Register and neither do the (very cool btw) spacehandler scripts. Instead it would be useful to have an event handler for object selection change (or even other things such as enter/exit editmode, etc.) This will allow gui's to become much more responsive to the user and thereby much more user-friendly.
<br><br>thanks for your help & suggestions,<br>bydesign<br> 


<br>_______________________________________________<br>Bf-python mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:Bf-python@projects.blender.org">Bf-python@projects.blender.org</a><br>
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://projects.blender.org/mailman/listinfo/bf-python" target="_blank">http://projects.blender.org/mailman/listinfo/bf-python</a><br><br><br></blockquote></div>
<br>