Created
May 8, 2019 11:54
-
-
Save navinthenapster/e0c0f4ff8be36985cecc6c4f98a0ca33 to your computer and use it in GitHub Desktop.
Creating the signal in the python program for inter process communication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pydispatch import dispatcher | |
SIGNAL = 'my-first-signal' | |
def handle_event( **kwargs ): | |
"""Simple event handler""" | |
print 'Signal was sent by', kwargs['message'] | |
dispatcher.connect( handle_event, signal=SIGNAL, sender=dispatcher.Any ) | |
first_sender = "sender" | |
second_sender = "sender" | |
def main( ): | |
dispatcher.send(message="test", signal=SIGNAL, sender=first_sender ) | |
dispatcher.send(message="test1", signal=SIGNAL, sender=second_sender ) | |
if __name__ == "__main__": | |
main() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment