Update of "Usage"

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.


Artifact ID: 64bb67671587b0923a7a31dffa14c08e899f491bcb66b415a0b9290853e8b401
Page Name:Usage
Date: 2018-02-04 19:43:28
Original User: gwlester
Parent: 2a21c286e1eb46ac6e892fb5b377fde8c46442adae80ed2d167b8add0e65cca0


package require pyman

pyman addPath pathName

This will add pathName to the list of directories that Python searches for where to find Python module files to be imported.  This is roughly akin to lappend of a directory to Tcl's auto_path variable or doing a ::tcl::tm::path add to add a directory to the directories searched for module files.

pyman import ?-namespace nsName? pythonModuleFileName

This will import the Python module and analize the module using the Python introspection tools. The following will be done:
  1. A namespace to contail the Tcl functions and class wrapers for the functions and class will be created.  If the -namesapce option was present than its value, nsName, will be used.  Otherwise the namespace will be named ::pyman::pythonModuleName where pythonModuleName is the name of the Python module that was imported.
  2. For each function found in the module, a Tcl wrapper function will be generated that take the same arguments and will call the Python function and return its results.
  3. For each class  found in the module, a TclOO wrapper class will be generated.  This class will have the same methods with the same arguments as the public methods in the Python class.  
  4. Creation of a new TclOO object of this class will result in a Python object of the same class being created.  
    • (Not yet implemented) Calls to class methods of the class will call static methods of the Python class.
    • Calls to instance methods of the class will call instance methods of the corresponding Python object instances.
    • Instance attributes can be accessed via the following special methods:
      • _attributes -- Get a list of attributes and their allowed values. 
      • _getAttribute attributeName -- Return the value of the named attribute.
      • _setAttribute attributeName value -- Set the named attribute to the specified value. (Note: not all attributes can be modified).
    • The Tcl programmer is allowed to add additional methods and/ or variables to the  TclOO class and/or instances of the class, these will only be visble from Tcl.