onDraw()

One of two event handler methods that get called by the main loop to redraw the world. Shapes that are drawn from this method are placed in 3D, perspective space. The frequency by which it gets called depends on the value that is assigned to <world>.fps. The default frequency is 40 times per second.

Relevant examples: hello_world.py , sprite.py , tag.py

In Context

In the World

class Atlantis(World):
    def onDraw(self):
        line(-1, 0, -0.5, 1, 0, 0.5)
class Atlantis(World):
    def onDraw(self):
        glBegin(GL_LINES)
        glVertex3f(2, 0, 0.0)
        glVertex3f(2, 1, 0.0)
        glEnd()

In a Sprite: Sprites are generally drawn in perspective space.

class Dot(Sprite):
    def onDraw(self):
        line(-1, 0, -0.5, 1, 0, 0.5)
Initiated by Stephan Hechenberger
Thanks to CADRE's 103