Welcome to pyprojector’s documentation!

Installation

Install pyprojector with pip:

$ pip install pyprojector

Reference

pyprojector.window(size=(width, height), title: str, icon: str, fps: int) → Window

The default fps is 60. Set fps to 0 to disable sleep during the Window.update().

Window.update(framebuffer: int) → bool

framebuffer is an OpenGL Framebuffer Object.

Note

The framebuffer must be a valid OpenGL Framebuffer Object in the windows context. If the framebuffer was created in another OpenGL context that does not share objects with the window’s OpenGL context, the render will fail silently.

Window.visible:bool

Examples

simple window

import moderngl
import pyprojector

wnd = pyprojector.window((840, 480), __file__, fps=60)
ctx = moderngl.context()
wnd.detach()

rbo = ctx.renderbuffer(wnd.size)
fbo = ctx.framebuffer(rbo)

while wnd.visible:
    fbo.clear(color=(0.0, 0.0, 0.0))
    wnd.update(rbo)