code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
'''Wrapper for Xi
Generated with:
tools/genwrappers.py xinput
Do not modify this file.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import ctypes
from ctypes import *
import pyglet.lib
_lib = pyglet.lib.load_library('Xi')
_int_types = (c_int16, c_int32)
if hasattr(ctypes, 'c_int64'):
# Some b... | Python |
#!/usr/bin/python
# $Id:$
from docutils.core import publish_doctree
from docutils import nodes
import pyglet
from pyglet.text.formats import structured
class Stylesheet(object):
default = dict(
font_name='Times New Roman',
font_size=12,
margin_bottom=12)
emphasis = dict(
ital... | Python |
#!/usr/bin/env python
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
from timeit import Timer
NUMBER=100000
setup='''
from pyglet.gl.VERSION_1_1 import glBindTexture, glEnable, GL_TEXTURE_2D
from pyglet.gl.VERSION_1_1 import glBegin, glEnd, glVertex2f, GL_LINES
from pyglet.window import Window
fro... | Python |
# Number MacBook
# 500 59.1715965271
# 1000 29.5857982635
# 2000 19.8412704468
import os
import sys
import random
import pygame
import pygame.time
from pygame.locals import *
pygame.init()
win = pygame.display.set_mode((600, 600))
ww, wh = win.get_size()
img = pygame.image.load('examples/nois... | Python |
#!/usr/bin/env python
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '1.2'
import sys
from pyglet import clock
from pyglet import image
from pyglet import window
class AnimationPlayer(object):
expected_delay = 0
def __init__(self, animation):
self.animation = animation
self.index... | Python |
#!/usr/bin/env python
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import gzip
import cPickle as marshal
import optparse
import os
import sys
import xml.sax
def parse_type(type_string):
'''Get a tuple of the type components for a SWIG-formatted type.
For example, given the type "p.f(p.... | Python |
#!/usr/bin/env python
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import ctypes as c
import gzip
import marshal
import sys
class AnonymousStruct(c.Structure):
__slots__ = ()
_fields_ = (
('foo', c.c_int),
)
class AnonymousUnion(c.Union):
__slots__ = ()
_fields_ = (... | Python |
#!/usr/bin/env python
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import optparse
import os
import re
import subprocess
import sys
import parse
def create_swig_interface(header_filename, interface_filename,
includes=(), module_name=None, defines=()):
defines = l... | Python |
#!/usr/bin/env python
# -*- coding: latin-1 -*-
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import math
import random
import re
import os.path
import pyglet
from pyglet.gl import *
import xml.dom
import xml.dom.minidom
class SmoothLineGroup(pyglet.graphics.Group):
def set_state(self):
... | Python |
#!/usr/bin/env python
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import time
from pyglet.ext.layout import *
from pyglet.window import *
window = Window(visible=False)
def print_time(start, msg):
dt = time.time() - start
print '%f\t%s' % (dt, msg)
def profile(xhtml, widths=[800,600,4... | Python |
#!/usr/bin/python
# $Id:$
import ctypes
import sys
import pyglet
from pyglet.window import key
from pyglet.gl import *
class Shader(object):
'''Generic shader loader.'''
def __init__(self, vertex_source, fragment_source=None):
vertex_shader = self._create_shader(GL_VERTEX_SHADER, vertex_source)
... | Python |
#!/usr/bin/python
# $Id:$
import ctypes
import math
import optparse
import pyglet
root2 = math.sqrt(2)
def gen_dist_field(img, width, height, spread, bidirectional=True):
sample_width = img.width // width
sample_height = img.height // height
max_dist = spread * root2
dist_scale = 127. / max_dist
... | Python |
#!/usr/bin/env python
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import math
import warnings
import pyglet
import pyglet.image
try:
from pyglet.gl.VERSION_1_5 import *
except ImportError:
warnings.warn('OpenGL 1.5 or later is required collision detection. '\
'Please u... | Python |
from ctypes import *
from pyglet.gl import *
class GLSLException(Exception): pass
def glsl_log(handle):
if handle == 0:
return ''
log_len = c_int(0)
glGetObjectParameterivARB(handle, GL_OBJECT_INFO_LOG_LENGTH_ARB,
byref(log_len))
if log_len.value == 0:
return ''
log = ... | Python |
'''Wrapper for avformat
Generated with:
../tools/wraptypes/wrap.py /usr/include/ffmpeg/avformat.h -o lib_avformat.py
.. Then hacked. DON'T REGENERATE.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import ctypes
from ctypes import *
from avcodec import get_library
_lib = get_library('avformat')
_in... | Python |
#!/usr/bin/env python
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import code
import sys
import traceback
import pyglet.event
import pyglet.text
from pyglet.window import key
from pyglet.gl import *
class Console(object):
def __init__(self, width, height, globals=None, locals=None):
... | Python |
#!/usr/bin/env python
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import os
import shutil
import sys
# Bump pyglet/__init__.py version as well.
VERSION = '1.2alpha1'
long_description = '''pyglet provides an object-oriented programming
interface for developing games and other visually-rich appli... | Python |
#!/usr/bin/env python
from __future__ import print_function
import os
import os.path as op
import sys
import shutil
import inspect
import webbrowser
from subprocess import call, check_output
THIS_DIR = op.dirname(op.abspath(__file__))
DOC_DIR = op.join(THIS_DIR, 'doc')
def clean():
dirs = [op.join(DOC_DIR, '_buil... | Python |
#!/usr/bin/env python
'''Test that window move event works correctly.
Expected behaviour:
One window will be opened. Move the window and ensure that the
location printed to the terminal is correct.
Close the window or press ESC to end the test.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id:... | Python |
#!/usr/bin/env python
'''Test that window size can be set.
Expected behaviour:
One window will be opened. The window's dimensions will be printed
to the terminal.
- press "x" to increase the width
- press "X" to decrease the width
- press "y" to increase the height
- press "Y" to decre... | Python |
#!/usr/bin/env python
'''Test that vsync can be set.
Expected behaviour:
A window will alternate between red and green fill.
- Press "v" to toggle vsync on/off. "Tearing" should only be visible
when vsync is off (as indicated at the terminal).
Not all video drivers support vsync. On Linux,... | Python |
#!/usr/bin/env python
'''Test that multiple windows share objects by default.
This test is non-interactive.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import unittest
from ctypes import *
from pyglet import window
from pyglet.gl import *
__noninteractive = True
class CONTEXT_SHARE(unittest.Tes... | Python |
#!/usr/bin/python
# $Id:$
from pyglet.gl import *
def draw_client_border(window):
glClearColor(0, 0, 0, 1)
glClear(GL_COLOR_BUFFER_BIT)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
glOrtho(0, window.width, 0, window.height, -1, 1)
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()... | Python |
#!/usr/bin/env python
'''Test that a window can be opened fullscreen.
Expected behaviour:
A fullscreen window will be created, with a flat purple colour.
- Press 'g' to leave fullscreen mode and create a window.
- Press 'f' to re-enter fullscreen mode.
- All events will be printed to the console. ... | Python |
#!/usr/bin/env python
'''Test that window icon can be set.
Expected behaviour:
One window will be opened. It will have an icon depicting a yellow
"A".
Close the window or press ESC to end the test.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: WINDOW_SET_MOUSE_CURSOR.py 717 2007-03-03 07:... | Python |
#!/usr/bin/env python
'''Test that a window can have multisample.
A window will be opened containing two rotating squares. Initially,
there will be no multisampling (the edges will look "jaggy"). Press:
* M to toggle multisampling on/off
* S to increase samples (2, 4, 6, 8, 10, ...)
* Shift+S to... | Python |
#!/usr/bin/env python
'''Test that text events work correctly.
Expected behaviour:
One window will be opened. Type into this window and check the console
output for text events.
- Repeated when keys are held down
- Motion events (e.g., arrow keys, HOME/END, etc) are reported
- Select events ... | Python |
#!/usr/bin/python
# $Id:$
import unittest
import time
class BaseEventSequence(unittest.TestCase):
next_sequence = 0
last_sequence = 0
finished = False
timeout = 2
start_time = time.time()
def check_sequence(self, sequence, name):
if self.next_sequence == 0 and sequence != 0:
... | Python |
#!/usr/bin/env python
'''Test that screens can be selected for fullscreen.
Expected behaviour:
One window will be created fullscreen on the primary screen. When you
close this window, another will open on the next screen, and so
on until all screens have been tested.
Each screen will be filled ... | Python |
#!/usr/bin/env python
'''Test that a non-resizable window's size can be set.
Expected behaviour:
One window will be opened. The window's dimensions will be printed
to the terminal.
- press "x" to increase the width
- press "X" to decrease the width
- press "y" to increase the height
- ... | Python |
#!/usr/bin/env python
'''Test that image mouse cursor can be set.
Expected behaviour:
One window will be opened. The mouse cursor in the window will be
a custom cursor.
Close the window or press ESC to end the test.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import unittest
from pygl... | Python |
#!/usr/bin/env python
'''Test that the window can be hidden and shown.
Expected behaviour:
One window will be opened. Every 5 seconds it will toggle between
hidden and shown.
Press escape or close the window to finish the test.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import time
... | Python |
#!/usr/bin/env python
'''Test that exclusive keyboard mode can be set.
Expected behaviour:
One window will be opened. Press 'e' to enable exclusive mode and 'E'
to disable exclusive mode.
In exclusive mode:
- Pressing system keys, the Expose keys, etc., should have no effect
besides displayi... | Python |
#!/usr/bin/env python
'''Test that mouse cursor can be set to a platform-dependent image.
Expected behaviour:
One window will be opened. Press the left and right arrow keys to cycle
through the system mouse cursors. The current cursor selected will
be printed to the terminal.
Note that not all curs... | Python |
#!/usr/bin/env python
'''Test that window style can be tool.
Expected behaviour:
One tool-styled window will be opened.
Close the window to end the test.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: WINDOW_SET_MOUSE_CURSOR.py 717 2007-03-03 07:04:10Z Alex.Holkner $'
import unittest
from pygl... | Python |
#!/usr/bin/env python
'''Test that mouse motion event works correctly.
Expected behaviour:
One window will be opened. Move the mouse in and out of this window
and ensure the absolute and relative coordinates are correct.
- Absolute coordinates should have (0,0) at bottom-left of client area
of wi... | Python |
#!/usr/bin/env python
'''Test that mouse drag event works correctly.
Expected behaviour:
One window will be opened. Click and drag with the mouse and ensure
that buttons, coordinates and modifiers are reported correctly. Events
should be generated even when the drag leaves the window.
Close the win... | Python |
#!/usr/bin/env python
'''Test that the window can be activated (focus set).
Expected behaviour:
One window will be opened. Every 5 seconds it will be activated;
it should be come to the front and accept keyboard input (this will
be shown on the terminal).
On Windows XP, the taskbar icon may flash (i... | Python |
#!/usr/bin/env python
'''Test that window icon can be set for multiple sizes.
Expected behaviour:
One window will be opened. The window's icon depends on the icon
size:
16x16 icon is a yellow "1"
32x32 icon is a purple "2"
48x48 icon is a cyan "3"
72x72 icon is a red "4"
128x12... | Python |
#!/usr/bin/env python
'''Test that window can be minimized and maximized.
Expected behaviour:
One window will be opened.
- press "x" to maximize the window.
- press "n" to minimize the window.
Close the window or press ESC to end the test.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id... | Python |
#!/usr/bin/python
# $Id:$
import unittest
from pyglet import window
import base_event_sequence
__noninteractive = True
class TEST_CLASS(base_event_sequence.BaseEventSequence):
last_sequence = 3
def on_resize(self, width, height):
self.check_sequence(1, 'on_resize')
def on_show(self):
... | Python |
#!/usr/bin/env python
# $Id: $
import unittest
from pyglet import window
import base_event_sequence
__noninteractive = True
class TEST_CLASS(base_event_sequence.BaseEventSequence):
last_sequence = 2
def on_resize(self, width, height):
self.check_sequence(1, 'on_resize')
def on_expose(self):
... | Python |
#!/usr/bin/env python
'''Test that mouse enter and leave events work correctly.
Expected behaviour:
One window will be opened. Move the mouse in and out of this window
and ensure the events displayed are correct.
Close the window or press ESC to end the test.
'''
__docformat__ = 'restructuredtext'
__ve... | Python |
#!/usr/bin/env python
'''Test that a window can be opened.
Expected behaviour:
One small window will be opened coloured purple.
Close the window or press ESC to end the test.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import unittest
from pyglet import window
from pyglet.gl import *
clas... | Python |
#!/usr/bin/env python
'''Test that window can be resized.
Expected behaviour:
One window will be opened. It should be resizable by the user.
Close the window or press ESC to end the test.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: WINDOW_SET_MOUSE_CURSOR.py 717 2007-03-03 07:04:10Z Alex.Ho... | Python |
#!/usr/bin/env python
'''Test that activate and deactivate events work correctly.
Expected behaviour:
One window will be opened. Clicking on the window should activate it,
clicking on another window should deactivate it. Messages will be
printed to the console for both events.
On OS X you can also ... | Python |
#!/usr/bin/env python
'''Test that mouse button events work correctly.
Expected behaviour:
One window will be opened. Click within this window and check the console
output for mouse events.
- Buttons 1, 2, 4 correspond to left, middle, right, respectively.
- No events for scroll wheel
- Modi... | Python |
#!/usr/bin/env python
'''Test that window expose event works correctly.
Expected behaviour:
One window will be opened. Uncovering the window from other windows
or the edge of the screen should produce the expose event.
Note that on OS X and other compositing window managers this event
is equivalent ... | Python |
#!/usr/bin/env python
'''Test that minimum and maximum window size can be set.
Expected behaviour:
One window will be opened. The window's dimensions will be printed
to the terminal. Initially the window has no minimum or maximum
size (besides any OS-enforced limit).
- press "n" to set the minimum... | Python |
#!/usr/bin/env python
'''Test that window style can be borderless.
Expected behaviour:
One borderless window will be opened.
Mouse click in the window to close it and end the test.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: WINDOW_SET_MOUSE_CURSOR.py 717 2007-03-03 07:04:10Z Alex.Holkner $'
... | Python |
#!/usr/bin/env python
# $Id: $
import unittest
from pyglet import window
import base_event_sequence
__noninteractive = True
class TEST_CLASS(base_event_sequence.BaseEventSequence):
last_sequence = 3
def on_resize(self, width, height):
self.check_sequence(1, 'on_resize')
def on_show(self):
... | Python |
#!/usr/bin/env python
'''Test that key press and release events work correctly.
Expected behaviour:
One window will be opened. Type into this window and check the console
output for key press and release events. Check that the correct
key symbol and modifiers are reported.
Close the window or press... | Python |
#!/usr/bin/env python
'''Test that mouse cursor can be made visible and hidden.
Expected behaviour:
One window will be opened. Press 'v' to hide mouse cursor and 'V' to
show mouse cursor. It should only affect the mouse when within the
client area of the window.
Close the window or press ESC to end... | Python |
#!/usr/bin/env python
'''Test that multiple windows can be opened.
Expected behaviour:
Two small windows will be opened, one coloured yellow and the other
purple.
Close either window or press ESC to end the test.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import unittest
from pyglet... | Python |
#!/usr/bin/env python
'''Test that window can be set fullscreen and back again.
Expected behaviour:
One window will be opened.
- press "f" to enter fullscreen mode.
- press "g" to leave fullscreen mode.
All events will be printed to the terminal.
Close the window or press ESC to end the tes... | Python |
#!/usr/bin/env python
'''Test that the window caption can be set.
Expected behaviour:
Two windows will be opened, one with the caption "Window caption 1"
counting up every second; the other with a Unicode string including
some non-ASCII characters.
Press escape or close either window to finished the ... | Python |
#!/usr/bin/env python
# $Id: $
import unittest
from pyglet import window
import base_event_sequence
__noninteractive = True
class TEST_CLASS(base_event_sequence.BaseEventSequence):
last_sequence = 2
def on_resize(self, width, height):
self.check_sequence(1, 'on_resize')
def on_expose(self):
... | Python |
#!/usr/bin/env python
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import unittest
from pyglet import window
from pyglet.window.event import WindowEventLogger
from pyglet.window import key
from pyglet.gl import *
import window_util
class WINDOW_SET_FULLSCREEN(unittest.TestCase):
def on_te... | Python |
#!/usr/bin/env python
'''Test that window location can be set.
Expected behaviour:
One window will be opened. The window's location will be printed
to the terminal.
- Use the arrow keys to move the window.
Close the window or press ESC to end the test.
'''
__docformat__ = 'restructuredtext'
__v... | Python |
#!/usr/bin/env python
'''Test that window style can be dialog.
Expected behaviour:
One dialog-styled window will be opened.
Close the window or press ESC to end the test.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: WINDOW_SET_MOUSE_CURSOR.py 717 2007-03-03 07:04:10Z Alex.Holkner $'
import un... | Python |
#!/usr/bin/env python
'''Test that exclusive mouse mode can be set.
Expected behaviour:
One window will be opened. Press 'e' to enable exclusive mode and 'E'
to disable exclusive mode.
In exclusive mode:
- the mouse cursor should be invisible
- moving the mouse should generate events with bogu... | Python |
#!/usr/bin/env python
'''Test that close event works correctly.
Expected behaviour:
One window will be opened. Click the close button and ensure the
event is printed to the terminal. The window should not close
when you do this.
Press ESC to end the test.
'''
__docformat__ = 'restructuredtext'
__v... | Python |
#!/usr/bin/env python
'''Test that resize event works correctly.
Expected behaviour:
One window will be opened. Resize the window and ensure that the
dimensions printed to the terminal are correct. You should see
a green border inside the window but no red.
Close the window or press ESC to end the ... | Python |
#!/usr/bin/env python
'''Test that mouse scroll event works correctly.
Expected behaviour:
One window will be opened. Move the scroll wheel and check that events
are printed to console. Positive values are associated with scrolling
up.
Scrolling can also be side-to-side, for example with an Apple M... | Python |
#!/usr/bin/env python
'''Test that window can be set to and from various fullscreen sizes.
Expected behaviour:
One window will be opened. Press a number to switch to the corresponding
fullscreen size; hold control and press a number to switch back
to the corresponding window size:
0 - Default si... | Python |
#!/usr/bin/env python
# $Id: $
import unittest
from pyglet import window
import base_event_sequence
__noninteractive = True
class TEST_CLASS(base_event_sequence.BaseEventSequence):
last_sequence = 3
def on_resize(self, width, height):
self.check_sequence(1, 'on_resize')
def on_show(self):
... | Python |
#!/usr/bin/env python
'''Test that show and hide events work correctly.
Expected behaviour:
One window will be opened. There should be one shown event printed
initially. Minimizing and restoring the window should produce hidden
and shown events, respectively.
On OS X the events should also be fired... | Python |
#!/usr/bin/env python
'''Test framework for pyglet. Reads details of components and capabilities
from a requirements document, runs the appropriate unit tests.
How to Run the Tests
--------------------
::
python tests/test.py top app graphics clock resource # these all run automatically
python tests/test.py... | Python |
#!/usr/bin/env python
"""Tests immediate drawing.
"""
import unittest
import pyglet
from graphics_common import GraphicsGenericTestCase, get_feedback, GL_TRIANGLES
__noninteractive = True
class GraphicsImmediateTestCase(GraphicsGenericTestCase, unittest.TestCase):
def get_feedback(self, data):
return g... | Python |
#!/usr/bin/env python
"""Tests immediate drawing using indexed data.
"""
import unittest
import pyglet
from graphics_common import GraphicsIndexedGenericTestCase, get_feedback, GL_TRIANGLES
__noninteractive = True
class GraphicsIndexedImmediateTestCase(GraphicsIndexedGenericTestCase, unittest.TestCase):
def ge... | Python |
#!/usr/bin/env python
"""Tests vertex list drawing.
"""
import unittest
import pyglet
from graphics_common import GraphicsGenericTestCase, get_feedback, GL_TRIANGLES
__noninteractive = True
class GraphicsVertexListTestCase(GraphicsGenericTestCase, unittest.TestCase):
def get_feedback(self, data):
verte... | Python |
#!/usr/bin/python
# $Id:$
import random
import unittest
from pyglet.graphics import allocation
__noninteractive = True
class Region(object):
def __init__(self, start, size):
self.start = start
self.size = size
def __repr__(self):
return 'Region(%r, %r)' % (self.start, self.size)
cl... | Python |
#!/usr/bin/env python
'''Draws a full-window quad with two texture units enabled and multi
texcoords. Texture unit 0 is a checker pattern of yellow and cyan with
env mode replace. Texture unit 1 is a checker pattern of cyan and yellow,
with env mode modulate. The result should be flat green (with some variation
in ... | Python |
#!/usr/bin/env python
"""Tests vertex list drawing using indexed data.
"""
import unittest
import pyglet
from graphics_common import GraphicsIndexedGenericTestCase, get_feedback, GL_TRIANGLES
__noninteractive = True
class GraphicsIndexedVertexListTestCase(GraphicsIndexedGenericTestCase, unittest.TestCase):
def... | Python |
#!/usr/bin/env python
from abc import abstractmethod
import random
from collections import deque
from pyglet.gl import *
# http://stackoverflow.com/a/312464/931303
def chunks(l, n):
""" Yield successive n-sized chunks from l.
"""
for i in xrange(0, len(l), n):
yield l[i:i+n]
def get_feedback(f... | Python |
#!/usr/bin/env python
'''Test that audio playback works.
You should hear white noise (static) for 0.5 seconds. The test will exit
immediately after.
You may want to turn down the volume of your speakers.
'''
import unittest
from pyglet import media
from pyglet.media import procedural
class TEST_... | Python |
#!/usr/bin/env python
'''Test that audio playback works.
You should hear white noise (static) for 0.5 seconds. The test will exit
immediately after.
You may want to turn down the volume of your speakers.
'''
import unittest
from pyglet import media
from pyglet.media import procedural
class TEST_... | Python |
#!/usr/bin/env python
'''Test that audio playback works.
You should hear white noise (static) for 0.5 seconds. The test will exit
immediately after.
You may want to turn down the volume of your speakers.
'''
import unittest
from pyglet import media
from pyglet.media import procedural
class TEST_... | Python |
#!/usr/bin/env python
'''Test that audio playback works.
You should hear white noise (static) for 0.25 seconds, then a 0.5 second pause
then another 0.25 seconds of noise. The test will exit immediately after.
You may want to turn down the volume of your speakers.
'''
import unittest
import time
... | Python |
#!/usr/bin/env python
'''Test that audio playback works.
You should hear white noise (static) for 0.5 seconds. The test will exit
immediately after.
You may want to turn down the volume of your speakers.
'''
import unittest
from pyglet import media
from pyglet.media import procedural
class TEST_... | Python |
#!/usr/bin/env python
'''Test that audio playback works.
You should hear a tone at 440Hz (A above middle C) for 1.0 seconds. The test
will exit immediately after.
You may want to turn down the volume of your speakers.
'''
import unittest
from pyglet import media
from pyglet.media import procedural
... | Python |
#!/usr/bin/python
# $Id:$
import os
import sys
import unittest
from pyglet.gl import *
from pyglet import image
from pyglet import resource
from pyglet import window
__noninteractive = True
# Test image is laid out
# M R
# B G
# In this test the image is sampled at four points from top-right cloc... | Python |
#!/usr/bin/env python
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
__noninteractive = True
'''
Layout:
. (script home)
file.txt F1
dir1/
file.txt F2
dir1/
file.txt F3
res.zip/... | Python |
#!/usr/bin/env python
'''Test that all public modules are accessible after importing just 'pyglet'.
This _must_ be the first test run.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: TICK.py 310 2006-12-23 15:56:35Z Alex.Holkner $'
import unittest
import pyglet
__noninteractive = True
modules = [
... | Python |
#!/usr/bin/python
'''Test that the event loop can do timing.
The test will display a series of intervals, iterations and sleep times.
It should then display an incrementing number up to 2x the number of
iterations, at a rate determined by the interval.
'''
import sys
import unittest
import pyglet
__non... | Python |
#!/usr/bin/env python
'''Test that text will not wrap when its width is set to its calculated
width.
You should be able to clearly see "TEST TEST" on a single line (not two)
and "SPAM SPAM SPAM" over two lines, not three.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import unittest
from . import ba... | Python |
#!/usr/bin/env python
'''Test that font.have_font() function works correctly.'''
import unittest
from pyglet import font
__noninteractive = True
class HAVE_FONT(unittest.TestCase):
def test_have_font(self):
self.assertTrue(font.have_font('Arial'))
self.assertFalse(font.have_font('missing-font-na... | Python |
#!/usr/bin/env python
'''Test that rendering of bullet glyphs works.
You should see 5 bullet glyphs rendered in the bottom-left of the window.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import unittest
from pyglet import font
from . import base_text
class TEST_HALIGN(base_text.TextTestBase):
... | Python |
#!/usr/bin/env python
'''Test that a font likely to be installed on the computer can be
loaded and displayed correctly.
One window will open, it should show "Quickly brown fox" at 24pt using:
* "Helvetica" on Mac OS X
* "Arial" on Windows
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import un... | Python |
#!/usr/bin/env python
'''Test that font.Text horizontal alignment works.
Three labels will be rendered aligned left, center and right.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import unittest
from pyglet import font
from . import base_text
class TEST_HALIGN(base_text.TextTestBase):
font_... | Python |
#!/usr/bin/env python
'''Test that font colour is applied correctly. Default font should
appear blue.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import unittest
from . import base_text
from pyglet import font
class TEST_COLOR(base_text.TextTestBase):
def render(self):
fnt = font.load... | Python |
#!/usr/bin/env python
'''Test that a specific DPI can be set to render the text with.
Some text in Action Man font will be displayed. A green box should exactly
bound the top and bottom of the text.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import os
import unittest
from pyglet.gl import *
fro... | Python |
#!/usr/bin/env python
'''Base class for text tests.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import unittest
import sys
from pyglet import gl
from pyglet import font
from pyglet.window import Window
from pyglet.window.event import key
from tests.regression import ImageRegressionTestCase
class... | Python |
#!/usr/bin/env python
'''Test that font.Text vertical alignment works.
Four labels will be aligned top, center, baseline and bottom.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import unittest
from pyglet import gl
from pyglet import font
from . import base_text
class TEST_VALIGN(base_text.Text... | Python |
#!/usr/bin/env python
'''Test that a font distributed with the application can be displayed.
Four lines of text should be displayed, each in a different variant
(bold/italic/regular) of Action Man at 24pt. The Action Man fonts are
included in the test directory (tests/font) as action_man*.ttf.
'''
__docformat__ = '... | Python |
#!/usr/bin/env python
'''Test that font.Text alignment works with multiple lines.
Three labels will be rendered at the top-left, center and bottom-right of the
window. Resize the window to ensure the alignment is as specified.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import unittest
from pygl... | Python |
#!/usr/bin/env python
'''Test that a font with no name given still renders using some sort
of default system font.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import unittest
from . import base_text
class TEST_DEFAULT(base_text.TextTestBase):
font_name = ''
if __name__ == '__main__':
uni... | Python |
#!/usr/bin/env python
'''Test that font colour is applied correctly. Default font should
appear at 0.1 opacity (faint white)
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import unittest
from . import base_text
from pyglet import font
class TEST_COLOR_BLEND(base_text.TextTestBase):
def render(s... | Python |
#!/usr/bin/env python
'''Test that the horizontal font metrics are calculated correctly.
Some text in various fonts will be displayed. Green vertical lines mark
the left edge of the text. Blue vertical lines mark the right edge of the
text.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import os
imp... | Python |
#!/usr/bin/env python
'''Test that a paragraph is broken or not according the settings in an
incremental layout.
Three windows will be open (one per test) showing:
- A paragraph in a single line, skipping newlines and no wrapping the line.
- A paragraph in multiple lines, but the long lines will no be wrapped.... | Python |
Subsets and Splits
SQL Console for ajibawa-2023/Python-Code-Large
Provides a useful breakdown of language distribution in the training data, showing which languages have the most samples and helping identify potential imbalances across different language groups.