[ctypes-users] Converting between ctypes data and Python data
by Carsten Wartmann other posts by this author
Feb 14 2006 7:38AM messages near this date
Re: [ctypes-users] ctypes 0.9.9.3 released
|
[ctypes-users] Re: Converting between ctypes data and Python data
Hello,
after yours help on this list I got my application working, in fact it
is working like a charm.
However, as I looked today on my "code" I noticed that I convert the
ctypes structures (given back from a dll function) into python data with
a simple for...in...: construct.
I guess there must be a better way?
I am converting this:
SPINKIT_HANDLE = c_void_p
class SPINKIT_DATA(Structure):
_fields_ = [("Device", SPINKIT_HANDLE),
("Spins", c_int * 6),
("Buttons", BOOL * 7)]
SPINKIT_DATA_SIZE = sizeof(SPINKIT_DATA)
into this:
class SpinkitPyData:
def __init__(self):
self.Handle = -1
self.Spins = [0,0,0,0,0,0]
self.Buttons = [False,False,False,False,False,False,False]
Hints very welcome,
Carsten
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
ctypes-users mailing list
ctypes-users@[...].net
https://lists.sourceforge.net/lists/listinfo/ctypes-users
Thread:
Carsten Wartmann
Thomas Heller
Carsten Wartmann
Thomas Heller
Carsten Wartmann
|