OSC3.py 文件源码

python
阅读 38 收藏 0 点赞 0 评论 0

项目:pyOSC3 作者: Qirky 项目源码 文件源码
def addMsgHandler(self, address, callback):
        """Register a handler for an OSC-address
          - 'address' is the OSC address-string. 
        the address-string should start with '/' and may not contain '*'
          - 'callback' is the function called for incoming OSCMessages that match 'address'.
        The callback-function will be called with the same arguments as the 'msgPrinter_handler' below
        """
        for chk in '*?,[]{}# ':
            if chk in address:
                raise OSCServerError("OSC-address string may not contain any characters in '*?,[]{}# '")

        if type(callback) not in (types.FunctionType, types.MethodType):
            raise OSCServerError("Message callback '%s' is not callable" % repr(callback))

        if address != 'default':
            address = '/' + address.strip('/')

        self.callbacks[address] = callback
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号