M
M
mklyushkin2021-09-13 13:30:24
PyQt
mklyushkin, 2021-09-13 13:30:24

How to pass image to QPixmap over Socket?

I am writing server and client code, where I form a Hash Table (dictionary) with arrays and transfer it over the socket, but there was a problem - this is writing a variable of the QPixmap type to the array, because on the server side I do not create the QGuiApplication class, so I cannot transfer the image in QPIxmap. How can an image be converted so that it can be written to an array on the server side and converted to a QPixmap on the client side.

{
            'ObjName':["", ""],
            'name':["", ""],
            'des':["", ""],
            'image':[QtGui.QPixmap("Путь"), QtGui.QPixmap("Путь")],
            'version':,
            'bought':[True, False],
            'download':
        }

Hash table

self.request.sendall(pickle.dumps(<Тут хеш таблица>))

Passing a hash table

self.ImageGame.setPixmap(image)
adding QPixmap to the program interface (Image is taken from this table)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question