Skip to content

Instantly share code, notes, and snippets.

@sebcagnon
Last active January 19, 2016 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebcagnon/db35ad7dedc25127a386 to your computer and use it in GitHub Desktop.
Save sebcagnon/db35ad7dedc25127a386 to your computer and use it in GitHub Desktop.
In a Python box with the onStopped output set to "string"
class MyClass(GeneratedClass):
def __init__(self):
GeneratedClass.__init__(self)
def onLoad(self):
#put initialization code here
self.id = None
def onUnload(self):
#put clean-up code here
if self.id:
self.session().service("ALTabletService").onInputText.disconnect(self.id)
def onInput_onStart(self):
#self.onStopped() #activate the output of the box
self.id = self.session().service("ALTabletService").onInputText.connect(self.callback)
def callback(self, i, text):
self.onStopped(text)
def onInput_onStop(self):
self.onUnload() #it is recommended to reuse the clean-up as the box is stopped
self.onStopped() #activate the output of the box
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment