This is the pyglet documentation, generated with sphinx.


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


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.


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.

class Class1():
'''Short description.

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


:since: pyglet 1.2


attribute1 = None
'''This is an attribute.

More details.

#: This is another attribute.
attribute2 = None

def __init__(self):

       `arg1` : type

    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


Deprecated. Do not use

:since: 1.2


Since 1.2

Internal references

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

Source Reference
:mod:`` The module
:func:`` 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


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

See also

Programming Guide - Internal references

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


The complete documentation can be generated using sphinx.


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

To build the documentation, execute:

./ docs

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


Table Of Contents

Previous topic


Next topic

Pyglet documentation system