Example #1
0
def get_display():
    """Get the default display device.

    If there is already a :class`~pyglet.canvas.Display`connection, that display will be 
    returned. Otherwise, a default :class`~pyglet.canvas.Display`is created and returned.  
    If multiple display connections are active, an arbitrary one is returned.

    .. versionadded:: 1.2

    :rtype: :class`~pyglet.canvas.Display`
    """
    # If there are existing displays, return one of them arbitrarily.
    for display in _displays:
        return display

    # Otherwise, create a new display and return it.
    return Display()
Example #2
0
def get_display():
    '''Get the default display device.

    If there is already a :class`~pyglet.canvas.Display`connection, that display will be 
    returned. Otherwise, a default :class`~pyglet.canvas.Display`is created and returned.  
    If multiple display connections are active, an arbitrary one is returned.

    .. versionadded:: 1.2

    :rtype: :class`~pyglet.canvas.Display`
    '''
    # If there's an existing display, return it (return arbitrary display if
    # there are multiple).
    from pyglet.app import displays
    for display in displays:
        return display

    # Otherwise, create a new display and return it.
    return Display()