How do I create a new signal in pygtk

后端 未结 3 952
走了就别回头了
走了就别回头了 2021-02-09 10:26

I\'ve created a python object, but I want to send signals on it. I made it inherit from gobject.GObject, but there doesn\'t seem to be any way to create a new signal on my obje

3条回答
  •  耶瑟儿~
    2021-02-09 10:40

    Here is how:

    import gobject
    
    class MyGObjectClass(gobject.GObject):
        ...
    
    gobject.signal_new("signal-name", MyGObjectClass, gobject.SIGNAL_RUN_FIRST,
        None, (str, int))
    

    Where the second to last argument is the return type and the last argument is a tuple of argument types.

提交回复
热议问题