Exemplo n.º 1
0
Arquivo: gl.py Projeto: bpmnnit/codes
def main():
    gl.foreground()
    gl.prefposition(500, 900, 500, 900)
    w = gl.winopen('CrissCross')
    gl.ortho2(0.0, 400.0, 0.0, 400.0)
    gl.color(GL.WHITE)
    gl.clear()
    gl.color(GL.RED)
    gl.bgnline()
    gl.v2f(0.0, 0.0)
    gl.v2f(400.0, 400.0)
    gl.endline()
    gl.bgnline()
    gl.v2f(400.0, 0.0)
    gl.v2f(0.0, 400.0)
    gl.endline()
    time.sleep(5)
Exemplo n.º 2
0
def main():
    # insure that we at least have an X display before continuing.
    import os
    try:
        display = os.environ['DISPLAY']
    except:
        # Raise ImportError because regrtest.py handles it specially.
        raise ImportError, "No $DISPLAY -- skipping gl test"

    # touch all the attributes of gl without doing anything
    if verbose:
        print 'Touching gl module attributes...'
    for attr in glattrs:
        if verbose:
            print 'touching: ', attr
        getattr(gl, attr)

    # create a small 'Crisscross' window
    if verbose:
        print 'Creating a small "CrissCross" window...'
        print 'foreground'
    gl.foreground()
    if verbose:
        print 'prefposition'
    gl.prefposition(500, 900, 500, 900)
    if verbose:
        print 'winopen "CrissCross"'
    w = gl.winopen('CrissCross')
    if verbose:
        print 'clear'
    gl.clear()
    if verbose:
        print 'ortho2'
    gl.ortho2(0.0, 400.0, 0.0, 400.0)
    if verbose:
        print 'color WHITE'
    gl.color(GL.WHITE)
    if verbose:
        print 'color RED'
    gl.color(GL.RED)
    if verbose:
        print 'bgnline'
    gl.bgnline()
    if verbose:
        print 'v2f'
    gl.v2f(0.0, 0.0)
    gl.v2f(400.0, 400.0)
    if verbose:
        print 'endline'
    gl.endline()
    if verbose:
        print 'bgnline'
    gl.bgnline()
    if verbose:
        print 'v2i'
    gl.v2i(400, 0)
    gl.v2i(0, 400)
    if verbose:
        print 'endline'
    gl.endline()
    if verbose:
        print 'Displaying window for 2 seconds...'
    time.sleep(2)
    if verbose:
        print 'winclose'
    gl.winclose(w)
Exemplo n.º 3
0
#! /usr/bin/env python
Exemplo n.º 4
0
def main():
    # insure that we at least have an X display before continuing.
    import os

    try:
        display = os.environ["DISPLAY"]
    except:
        raise TestSkipped, "No $DISPLAY -- skipping gl test"

    # touch all the attributes of gl without doing anything
    if verbose:
        print "Touching gl module attributes..."
    for attr in glattrs:
        if verbose:
            print "touching: ", attr
        getattr(gl, attr)

    # create a small 'Crisscross' window
    if verbose:
        print 'Creating a small "CrissCross" window...'
        print "foreground"
    gl.foreground()
    if verbose:
        print "prefposition"
    gl.prefposition(500, 900, 500, 900)
    if verbose:
        print 'winopen "CrissCross"'
    w = gl.winopen("CrissCross")
    if verbose:
        print "clear"
    gl.clear()
    if verbose:
        print "ortho2"
    gl.ortho2(0.0, 400.0, 0.0, 400.0)
    if verbose:
        print "color WHITE"
    gl.color(GL.WHITE)
    if verbose:
        print "color RED"
    gl.color(GL.RED)
    if verbose:
        print "bgnline"
    gl.bgnline()
    if verbose:
        print "v2f"
    gl.v2f(0.0, 0.0)
    gl.v2f(400.0, 400.0)
    if verbose:
        print "endline"
    gl.endline()
    if verbose:
        print "bgnline"
    gl.bgnline()
    if verbose:
        print "v2i"
    gl.v2i(400, 0)
    gl.v2i(0, 400)
    if verbose:
        print "endline"
    gl.endline()
    if verbose:
        print "Displaying window for 2 seconds..."
    time.sleep(2)
    if verbose:
        print "winclose"
    gl.winclose(w)