-
Sujet
-
import sys, os
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from requests import Session
from threading import Thread
from time import sleep
from pubnub.callbacks import SubscribeCallback
from pubnub.enums import PNStatusCategory
from pubnub.pnconfiguration import PNConfiguration
from pubnub.pubnub import PubNub##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
## PubNub Messaging Setup
##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
channel = ‘chat-channel’
pnconfig = PNConfiguration()pnconfig.publish_key = ‘__YOUR_PUBNUB_PUBLISH_KEY_HERE__’
pnconfig.subscribe_key = ‘__YOUR_PUBNUB_SUBSCRIBE_KEY_HERE__’pubnub = PubNub(pnconfig)
new_messages = []def pubnub_publish(data):
pubnub.publish().channel(channel).message(data).sync()class MySubscribeCallback(SubscribeCallback):
def message(self, pubnub, pn_message):
print(‘incoming_message’, pn_message.message)
new_messages.append(pn_message.message)def format_message(message_body):
return message_body.get(‘name’) + « : » + message_body.get(‘message’)pubnub.add_listener(MySubscribeCallback())
pubnub.subscribe().channels(channel).execute()##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
## GUI Setup
##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
def exit_handler():
os._exit(1)——————–
lelesagma – Envoyé depuis le Discord : Culte du code
- Vous devez être connecté pour répondre à ce sujet.