neoscore.core.document
- class neoscore.core.document.Document[source]
Bases:
object
The document root object.
This object should not be created directly by users - it is instantiated by
neoscore.setup
, which creates a global instance of this class which can be then accessed asneoscore.document
.- __init__(paper: Paper, overlay_func: Optional[Callable[[Page], None]] = None)[source]
- Parameters
paper – The paper to use in the document.
overlay_func – An optional function to run on each generated page.
- property pages: PageSupplier
The document’s pages.
Pages are created on-demand by accessing this property.
This property can be treated like a managed list:
>>> from neoscore.core import neoscore; neoscore.setup() >>> len(neoscore.document.pages) # No pages exist yet 0 >>> first_page = neoscore.document.pages[0] # Get the first page >>> len(neoscore.document.pages) # One page now exists 1 >>> sixth_page = neoscore.document.pages[5] # Get the sixth page >>> len(neoscore.document.pages) # 5 new pages are created 6 >>> # Pages can be accessed by negative indexing too >>> assert(first_page == neoscore.document.pages[-6]) >>> assert(sixth_page == neoscore.document.pages[-1]) >>> neoscore.shutdown()
For more information on this object, see
PageSupplier
.