Package pycocoa :: Module nstypes
[frames] | no frames]

Module nstypes


Version: 17.11.19

Classes
  NSInteger
  NSPoint
ObjC struct with x and y.
  NSRect
ObjC struc with origin and size.
  NSSize
ObjC struct with width and height.
  CFString
Create a CFString instance for a Python string.
  NSDecimalNumber
Optimized NSDecimalNumber class.
  NSString
Auto-released version of the CFString class.
  at
Acronym for the NSString class.
Functions
 
NSLog(fmt, *args)
Formatted write to the console.
 
NSMakePoint(x, y)
Return an NSPoint instance for the given x and y.
 
NSMakeRect(x, y, w, h)
Return an NSRect instance for the given point and size.
 
NSMakeSize(w, h)
Return an NSSize instance for the given w and h.
 
nsArray2listuple(nsArray, ctype=<class 'ctypes.c_void_p'>)
Create a Python list or tuple from an NS/CFArray.
 
nsBoolean2bool(nsBool, default=None)
Create a Python bool from an NS/CFBoolean.
 
nsData2bytes(nsData, default='')
Create Python bytes from NS/CFData.
 
nsDecimalNumber2decimal(nsDecimal)
Create a Python Decimal from an NS/CFDecimalNumber.
 
nsDictionary2dict(nsDict, ctype_keys=<class 'ctypes.c_void_p'>, ctype_vals=<class 'ctypes.c_void_p'>)
Create a Python dict from an NS/CFDictionary.
 
nsNull2none(nsNull)
Creat Python None from an NS/CFNull.
 
nsNumber2num(nsNumber, default=None)
Create a Python decimal, int or float from an NS/CFNumber.
 
nsSet2set(nsSet, ctype=<class 'ctypes.c_void_p'>)
Create a Python set or frozenset from an NS/CFSet.
 
nsString2str(nsString, default=None)
Create a Python string or unicode from an NS/CFString.
 
ns2py(nsObj, default=None)
Convert an (instance of an) NS/CFObject to the equivalent Python type and value.
 
py2NS(pyobj)
Convert an (instance of a) Python object into an instance of an NS...
Variables
  NSApplication = <ObjCClass NSApplication at 140735626076272>
  NSArray = <ObjCClass NSArray at 140735632965600>
  NSAutoreleasePool = <ObjCClass NSAutoreleasePool at 1407356375...
  NSBezierPath = <ObjCClass NSBezierPath at 140735626076552>
  NSColor = <ObjCClass NSColor at 140735626078472>
  NSData = <ObjCClass NSData at 140735632965800>
  NSDecimalNumber_ = <ObjCClass NSDecimalNumber at 140735637589320>
  NSDictionary = <ObjCClass NSDictionary at 140735632965920>
  NSEnumerator = <ObjCClass NSEnumerator at 140735632965960>
  NSImage = <ObjCClass NSImage at 140735626005792>
  NSMenu = <ObjCClass NSMenu at 140735626007472>
  NSMenuItem = <ObjCClass NSMenuItem at 140735626007552>
  NSMutableArray = <ObjCClass NSMutableArray at 140735632966240>
  NSMutableData = <ObjCClass NSMutableData at 140735632966280>
  NSMutableDictionary = <ObjCClass NSMutableDictionary at 140735...
  NSMutableSet = <ObjCClass NSMutableSet at 140735632966400>
  NSMutableString = <ObjCClass NSMutableString at 140735637593680>
  NSNull = <ObjCClass NSNull at 140735632966440>
  NSNumber = <ObjCClass NSNumber at 140735637593960>
  NSObject = <ObjCClass NSObject at 140735736934720>
  NSOpenPanel = <ObjCClass NSOpenPanel at 140735626011912>
  NSScreen = <ObjCClass NSScreen at 140735626015832>
  NSSet = <ObjCClass NSSet at 140735632966600>
  NSStatusBar = <ObjCClass NSStatusBar at 140735626018792>
  NSString_ = <ObjCClass NSString at 140735637597800>
  NSThread = <ObjCClass NSThread at 140735637598160>
  NSURL = <ObjCClass NSURL at 140735632966880>
  NSView = <ObjCClass NSView at 140735626025032>
  NSWindow = <ObjCClass NSWindow at 140735626025592>
  NSZeroPoint = NSPoint(0, 0)
Function Details

ns2py(nsObj, default=None)

 

Convert an (instance of an) NS/CFObject to the equivalent Python type and value.

  • NSArray -> tuple
  • NSBoolean -> bool
  • NSData -> bytes
  • NSDecimalNumber -> Decimal
  • NSDictionary -> dict
  • NSMutableArray -> list
  • NSMutableSet -> set
  • NSMutableString -> str
  • NSNumber -> int or float
  • NSNull -> None
  • NSSet -> frozenset
  • NSString -> str

py2NS(pyobj)

 

Convert an (instance of a) Python object into an instance of an NS... Objective-C class as follows:

  • bool -> NSBoolean/NSNumber
  • bytes -> NSData
  • bytearray -> NSData
  • Decimal -> NSDecimalNumber
  • dict -> NSMutableDictionary
  • float -> NSNumber
  • frozenset -> NSSet, immutable
  • int -> NSNumber
  • list -> NSMutableArray
  • None -> NSNull
  • set -> NSMutableSet
  • str -> NSString, immutable
  • tuple -> NSArray, immutable
  • unicode -> NSString, immutable

Variables Details

NSAutoreleasePool

Value:
<ObjCClass NSAutoreleasePool at 140735637587560>

NSMutableDictionary

Value:
<ObjCClass NSMutableDictionary at 140735632966320>