Python BoundEvent's not firing


#1

I’m trying to register some Python functions to the Rhino.RhinoDoc event handlers, eg:

import Rhino
import rhinoscriptsyntax as rs

def deselect_test(a, b):
    print "hello"
Rhino.RhinoDoc.DeselectAllObjects += deselect_test

def select_test(sender, e):
    print "hello select"
Rhino.RhinoDoc.SelectObjects += select_test

I’ve tried the above with both the RunPythonScript inline format and with a separate script, but neither function ever appears to fire when selecting and deselecting points and curves.

Are the BoundEvent interfaces available to Python scripts? If so how does one make use of them?


(Steve Baer) #2

That script works fine for me. I pasted it into the EditPythonScript editor and ran it; then made a circle or two and started selecting/deselecting them. ‘hello’ and ‘hello select’ are both printed to the command line.


#3

Well… now it works for me too, no idea what changed. Thanks for the quick reply.