Translations:Pivy/17/ja

FreeCADではそういったコールバックを簡単に使うための機能があります：

class ButtonTest: def __init__(self): self.view = FreeCADGui.ActiveDocument.ActiveView self.callback = self.view.addEventCallbackPivy(SoMouseButtonEvent.getClassTypeId,self.getMouseClick) def getMouseClick(self,event_cb): event = event_cb.getEvent if event.getState == SoMouseButtonEvent.DOWN: print "Alert!!! A mouse button has been improperly clicked!!!" self.view.removeEventCallbackSWIG(SoMouseButtonEvent.getClassTypeId,self.callback) ButtonTest