funkyeah
funkyeah

Reputation: 3194

How would you draw UDP data as it comes in?

I want to listen on a on a UDP socket for data that will be streamed in and draw it on screen as it comes in. I believe that the socket module with bind will be suitable for receiving the data on the socket, but I am not sure on the best manner to proceed in drawing the data. The image dimensions would be known beforehand and the raw data would be directly drawn starting from any corner and proceeding to fill the image box.

I would assume the tkinter library or PyQt would be suitable for this but I don't know if there is a better choice or what I should be aware of when going down either of these paths.

Upvotes: 0

Views: 293

Answers (2)

Bryan Oakley
Bryan Oakley

Reputation: 386285

Tkinter has a canvas widget which can be used for drawing. It is vector-based, with primitives for drawing lines, circles, etc. It is very easy to use, and surprisingly powerful.

If your drawing is more like a painting where you are receiving instructions for individual pixels, you can create an image, and with that you can change the colors of individual pixels.

Upvotes: 2

Harriv
Harriv

Reputation: 6137

kinter is included in Python, you need to install PyQt (or PySide) separately. Qt is more modern, so I would probably try it first if deployment isn't problem.

Upvotes: 2

Related Questions