How to draw a graph with OSC data?

import argparse

import math

from pythonosc import dispatcher

from pythonosc import osc_server

def eeg_handler(unused_addr, args, ch1, ch2, ch3, ch4, ch5):
    print("EEG (uV) per channel", ch1)

if __name__ == "__main__":

   parser = argparse.ArgumentParser()

   parser.add_argument("--ip",  default="", help="The ip to listen on")

   parser.add_argument("--port",  type=int, default=5000, help="The port to listen on")

   args = parser.parse_args()

   dispatcher = dispatcher.Dispatcher()"/debug", print)"/muse/eeg", eeg_handler, "EEG")

   server = osc_server.ThreadingOSCUDPServer((args.ip, args.port), dispatcher)

   print("Serving on {}".format(server.server_address))


I’ve been working with Python 3.6 code.
Now I can connect Muse headband - Muse Monitior app(OSC streaming) - Python successfully.
With the code above, I could see the data.

Now I want to draw a plot. But I even couldn’t put the data into a varible.
Since it is not a normal loop, I am confused.

What I found out is followings.

  1. When OSCUDP server working, dispatcher finds address “/muse/eeg” and run eeg_handler function.
  2. In eeg_handler function, it prints data ch1.

What should I do now?

I searched Github, Stack overflow as I was told by Enigma644.