Winand

Untitled

Mar 31st, 2015
349
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.  
  3. class FSCRT():
  4.     class FONT(Structure):
  5.         _fields_ = [('pData', c_void_p),]
  6.         def __del__(self):
  7.             print("font release")
  8. fscrt = FSCRT()
  9.  
  10. class FSPDF():
  11.     class TEXTSTATE(Structure):
  12.         _fields_ = [("font", fscrt.FONT),]
  13.         def __str__(self):
  14.             return "TEXTSTATE {font: %s}" % self.font
  15. fspdf = FSPDF()
  16.  
  17. state = fspdf.TEXTSTATE()
  18. state.font = fscrt.FONT()
  19. input(state)
  20.  
  21. -------OUTPUT-------
  22. font release
  23. font release
  24. TEXTSTATE {font: <__main__.FSCRT.FONT object at 0x0000000002AD1BC8>}
Advertisement
Add Comment
Please, Sign In to add comment