Last active
December 13, 2015 16:39
-
-
Save brianpeiris/4942152 to your computer and use it in GitHub Desktop.
A bit of Python code for listening to events from a PubNub channel and triggering a mouse wheel scroll event.
This file contains hidden or 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 Pubnub import Pubnub | |
from datetime import datetime | |
from guippy import mouse | |
subkey = '<your subcribe key>' | |
pubkey = '<your publish key>' | |
channel = '<your channel name>' | |
pubnub = Pubnub(pubkey, subkey, None, False) | |
def receive(message) : | |
print('%s message received: %s' % (datetime.now(), message)) | |
mouse._mouse_event(2048, 0, 0, -120 * 10) | |
return True | |
print('Listening for events from Twine...'); | |
pubnub.subscribe({ | |
'channel' : channel, | |
'callback' : receive | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment