Update of "Usage"

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


Artifact ID: c37be4c149fa257724830e6129a8fcbe9365154b8a0cdeff3b4d14d88cb9f555
Page Name:Usage
Date: 2018-02-05 21:13:36
Original User: gwlester
Parent: 64bb67671587b0923a7a31dffa14c08e899f491bcb66b415a0b9290853e8b401


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 ?pattern? -- Get a list of attributes that match the glob style pattern and their allowed values.   The default for pattern is "*".
      • _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.