Skip to content

Instantly share code, notes, and snippets.

@Paulchen-Panther
Created January 9, 2018 18:21
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 Paulchen-Panther/1399585f10f83772c7e694518cdb7acc to your computer and use it in GitHub Desktop.
Save Paulchen-Panther/1399585f10f83772c7e694518cdb7acc to your computer and use it in GitHub Desktop.
Python callback
from enum import Enum
from plugin import *
import time
import random
def onCompStateChangedAllEvents(comp, state):
log("onCompStateChangedAllEvents called")
def onCompStateChangedSpecificEvents(comp, state):
log("specific event " + comp + " called")
log("register callbacks")
#the callback onVisiblePriorityChangedAllEvents() is registered to all Events
registerCallback(ON_COMP_STATE_CHANGED, onCompStateChangedAllEvents)
#the callback onVisiblePriorityChangedAllEvents() is only registered to the specific Events COMP_SMOOTHING and COMP_BLACKBORDER
registerCallback(ON_COMP_STATE_CHANGED, onCompStateChangedSpecificEvents, [COMP_SMOOTHING, COMP_BLACKBORDER])
log("callback register complete")
while not abort():
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment