Winand

Untitled

Sep 30th, 2015
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. from ctypes import Structure, c_void_p
  2. class FONT(Structure):
  3.     _fields_ = [('pData', c_void_p),]
  4.     def __del__(self): print("release font", self)
  5. class SETTINGS(Structure):
  6.     _fields_ = [("font", FONT),]
  7. def setFont():
  8.     settings = SETTINGS()
  9.     f = FONT()
  10.     settings.font = f
  11.     print(settings.font)
  12.     print(settings)
  13. setFont()
  14.  
  15.  
  16. ----------------------
  17. <__main__.FONT object at 0x0000000004495948>
  18. release font <__main__.FONT object at 0x0000000004495948>
  19. <__main__.SETTINGS object at 0x00000000044958C8>
  20. release font <__main__.FONT object at 0x0000000004495848>
Advertisement
Add Comment
Please, Sign In to add comment