Documentation

This is the pyglet documentation, generated with sphinx.

Details:

Date 2015/09/02 04:27:02
pyglet version 1.2.4

Note

See the Sphinx warnings log file for errors.

Writing documentation

pyglet uses reStructuredText markup language for both the Programming Guide and the docstrings embedded in the code.

Literature

It is divided into several files, which are organized by toctree directives .

The entry point for all the documentation is pyglet/doc/index.txt, which calls to:

  • pyglet/doc/programming_guide: The first page of the programming guide.
  • pyglet/doc/internal: Documentation for those working on Pyglet itself, such as how to make a release or how the ctypes library is used.

Source code

The API documentation is generated from the source code docstrings.

Example:
class Class1():
'''Short description.

Detailed explanation, formatted as reST.
Can be as detailed as it is needed.


:Ivariables:
   `arg1`
       description


:since: pyglet 1.2

'''

attribute1 = None
'''This is an attribute.

More details.
'''

#: This is another attribute.
attribute2 = None


def __init__(self):
    '''Constructor

    :parameters:
       `arg1` : type
          description
    '''

    self.instance_attribute = None
    '''This is an instance attribute.
    '''

def method(self):
    '''Short description.

    :returns: return description
    :rtype: returned type
    '''

def _get_property1(self):
    '''Getter Method

    :return: property1 value
    :rtype: property1 type
    '''

def _set_property1(self, value):
    '''Setter Method

    :param value: property1 value # This is the ReST style
    :type value: property1 type   # But you can use :parameters:
    '''

property1 = property(_get_property1, _set_property1,
                  doc='''Short description

This is another attribute.

:type: type
:see: something else
''')

Pyglet has some special roles.

Source Shows
:deprecated: Do not use

Warning

Deprecated. Do not use

:since: 1.2

Note

Since 1.2

Internal references

To cross-reference to any documented API member, use the following roles:

Source Reference
:mod:`pyglet.app` The pyglet.app module
:func:`~pyglet.app.run` The run() function
:class:`~pyglet.window.Window` The Window class
:meth:`~pyglet.window.Window.close` The close() method
:attr:`~pyglet.window.Window.fullscreen` The fullscreen attribute

Note

Use ~ to show only the last part.

You can link to arbitrary locations in any document using :ref:, but pyglet has a special role :guide: for this guide.

A section header of the guide can have an anchor like this:

.. _guide_doc_ref:

Internal references
===================

It is also possible to put an anchor anywhere:

.. _my_anchor:

My anchor.

And to insert a reference to an anchor:

Source Shows
:guide:`doc_ref`

See also

Programming Guide - Internal references

:ref:`My Anchor<my_anchor>` My Anchor

Generation

The complete documentation can be generated using sphinx.

Requirements

  • sphinx: Documentation builder.
  • graphviz: If you want to generate graphs.

To build the documentation, execute:

./make.py docs

If the build succeeds, the web pages are in _build/html

Details

Table Of Contents

Previous topic

Distribution

Next topic

Pyglet documentation system