1
0
mirror of https://github.com/thp/pyotherside.git synced 2025-02-05 08:08:23 +08:00
pyotherside/qtquicktests/tst_bytes.py

11 lines
319 B
Python
Raw Permalink Normal View History

import struct
def get_bytes():
return struct.pack('<bhi', 123, 456, 789)
def set_bytes(bytedata):
print('Got this raw data from QML:', bytedata)
a, b, c = struct.unpack('<hhI', bytedata)
print('Got this data (unpacked) from QML:', a, b, hex(c))
return a == 1337 and b == -4711 and c == 0xcafebabe