Pyglet for multi-media Python

7.16: news.cyb/dev.py/pyglet for cross-platform gui:
. during rapd's 2009 python promo,
pyglet was listed along with scipy
as some examples of how python leads ruby
in everything but web programming?
that makes pyglet interesting!
(a cross-platform, BSD-licensed
windowing and multimedia Python library ):
. provides an oop interface for developing
games and other visually-rich applications
for Windows, Mac OS X and Linux.
The major 1.2alpha1 release
brings pyglet to Python 3.
Pyglet now also runs on 64-bit
Linux, Windows and OS X.
The OS X layer switched to using Cocoa.
There's also a load of bug fixes,
updates to the OpenGL wrappers
and other minor new improvements.

Some of the features of pyglet are:
# No external dependencies
or installation requirements.
# For most application and game requirements,
# pyglet needs nothing else besides Python,
# simplifying distribution and installation.
# Takes advantage of multiple windows
and multi-monitor desktops.
# Load images, sound, music and video
# in almost any format:
# pyglet can optionally use AVbin to playback
audio formats such as MP3, OGG/Vorbis and WMA,
and video formats such as
DivX, MPEG-2, H.264, WMV and Xvid.
compared to pygame 2010:
. if you want it done quickly, use pygame.
but in a serious project, go for Pyglet,
which is nicely designed and implemented.
daniweb 2009:
Pyglet is not a full GUI toolkit,
[ it's a kit for making gui kits ]
but has its strength in audio and video presentations.
using GL and FFmpeg .
sparkyb 2008`not a traditional gui kit:
a graphics/game library like Pygame or Pyglet
is not the right kind of thing for a [ desktop app ].
You're better off with a GUI toolkit that already has
things like text fields, buttons, lists, task tray icons, etc
than trying to build your own with a graphics library.
(the question for a desktop app then
is pyqt vs wxPython).
wikibooks python gui kits 2011:
(no mention of pyglet)
7.17: ironically,
there's a book by "(wikibooks contributers)
that recognizes Pyglet on Page 144:
2D Game Programming
... Pyglet is avaible[sic] under a BSD-Style license ...
[ also listed under 2D Game are Pygame (wraps SDL)
and Rabbyt (a fast Sprite library) ]
. indeed, here it is at wikibooks.org,
under 2D Game Programming:
    # Pyglet is a cross-platform windowing and multimedia library for Python
    with no external dependencies or installation requirements.
    # Pyglet provides an object-oriented programming interface
    for developing games and other visually-rich
    applications for Windows, Mac OS X and Linux.
    # Pyglet allows programs to open multiple windows on multiple screens,
    draw in those windows with OpenGL,
    and play back audio and video in most formats.
    # Unlike similar libraries available,
    pyglet has no external dependencies (such as SDL)
    and is written entirely in Python.
    Pyglet is available under a BSD-Style license.
    also mentioned are Pygame, Phil's Pygame Utilities (PGU)
    Kivy, and Rabbyt .
. of these entries, only Pygame is
noteworthy enough for wikipedia;
other links go to their respective sites instead .

. even more weird is this:
Pyglet [Paperback] by Ronald Cohn Jesse Russell
Publisher: VSD (January 1, 2012)
-- described as
    "( High Quality Content by WIKIPEDIA articles!
    Pyglet is an OpenGL-based software library
    used in developing games
    and other visually rich applications
    using the object-oriented language Python.
    This book was created using
    print-on-demand technology.
) but at wikipedia,
it's been deleted as not noteworthy !
. and as you might expect, amazon says
"(Currently unavailable.
We don't know when or if this item will be back in stock.)
. the same author did a wikipedia reprint of
wiki's Crystal_Meth_Anonymous page;
and, that is also listed as unavailable,
but wiki still has that article (one very short page).

wikipedia (Pyglet deleted):
. non-notable, yet one very notable thing about it,
advocates were pointing out,
is that it's used as the base for Cocos2d:
a framework for building 2D games, demos,
and other graphical/interactive applications.
main features of cocos2d:
# Pyglet Based: No external dependencies
# OpenGL Based: Hardware Acceleration
. but wiki says Cocos2d is notable essentially
for being no longer dependent on Pyglet;
rather, they've been very busy with
porting to java, c++, and obj'c .
. and, as a result of such porting
it was featured in the book:
More IPhone Cool Projects
(see section "Cocos2D for iPhone and iPad;
                    It Is Easier Than You Think")

-- easy iOS programming is very noteworthy,
because, Python isn't even allowed on iOS!

9.6: web: Pyglet's newsgroup:
On Saturday, 28 July 2012 12:30:04 UTC+2, Scott Porter wrote:
> I've just upgraded to OSX 10.8
  and installed Pyglet 1.2alpha. 
> Pyglet is now unable to create any windows. 
Adam Griffiths Sep 5, 11:55 pm
I've been using Python 2.7 with PyObjc 2.2
with Pyglet from head (or 1.2 alpha).
It's the only combination that's ever worked for me.
I'm able to run Pyglet on 10.7 and 10.8 without any problems.
I wrote about this here:
I installed pythonbrew, virtualenv
into the system python.
Then install 2.7 with pythonbrew
and install Pyglet from the repository.
If I remember correctly,
the problem people are having with 10.8
is the system python uses certain libs.
Avoid using it and you shouldn't have any problems.
02/21 installing-pyglet-in-mac-os-x/
. Pyglet 1.1 uses the Carbon framework,
but this is not compatible with 64-bit Python installs.
The Pyglet 1.2 branch has been modified to use Quartz, ...
We must instead install Pyglet from the Mercurial repository.
The Quartz bindings require the use of PyObjc ...
Travis Griggs Aug 28, 4:23 pm:
1) Download mercurial and install it.
2) Clone the pyglet repository by opening up a terminal and running:
    hg clone https://pyglet.googlecode.com/hg/ pyglet
3) Go into the pyglet directory and install it
(type in your password when  prompted and press enter):
    cd pyglet && sudo python setup.py install   
Tristam MacDonald's pyglet blogging .
. he wrote this pyglet openware:
simplui -- Lightweight GUI toolkit for pyglet.
simplui provides a lightweight and flexible GUI toolkit
for Python/OpenGL applications using pyglet.
Primarily intended as an aid in debugging and development,
simplui is generally overkill for in-game GUIs.
other openwares by same author:
pyeuclid and cocoa-python .

=== other pyglet-related projects
on code.google.com ===

== pyglet shouldn't depend on PyObjC ==
cocoa-python -- Port of Objective-C runtime
to Python using ctypes
"( Port of the Objective-C runtime to Python using ctypes
with the goal of being able to
use the Cocoa API on Mac OS X without PyObjC.
... so that pyglet could run without depending on PyObjC.)
== pyglet should interface xcb not just xlib ==
samurai-x -- a pure python window manager for X
"( samurai-x is written entirely in python using ctypes.
The xlib module is from http://pyglet.org
but project was halted to write an
xcb-based window manager.
. XCB (X protocol C-language Binding)
is a C language binding for the X Window System.
It is implemented as free software
and aims to replace Xlib.
Xlib/XCB provides application binary interface
compatibility with both Xlib and XCB,
providing an incremental porting path.
Xlib/XCB uses the protocol layer of Xlib,
but replaces the Xlib transport layer with XCB,
and provides access to the underlying XCB connection
for direct use of XCB.)
== Pyglet wasn't flexible and pyopengl too slow ==
pocketwatch -- An opengl graphics library for python.
"( Pocket watch is an OpenGL graphics library for python,
write simple 3d programs.
why!? what about pyglet?
Pyglet is awesome, and pocketwatch uses pyglet
to do some specific things
like window management, rendering text,
and opening images.
Pyglet now supports some features that
may have been useful to solving the problems
I had when I started writing pocketwatch.
But even then,
said features didn't seem flexible enough
to do what I wanted.
Maybe this is different now, maybe not. )
py-open-gl ?
"( using ctypes to do lots of opengl calls
is actually very SLOW.
So instead, I took all of the code that I could,
and wrote a simple C++ library
to do all the nitty gritty stuff,
and wrote a python state-sorter which could
render all of the objects with a single ctypes call.
. uses Python Imaging Library (PIL)
. PIL adds image processing capabilities
to your Python interpreter.
This library supports many file formats,
and provides powerful image processing
and graphics capabilities.)
== libraries that help you use Pyglet ==
pyglons -- rapid application framework for pyglet
"( No more boilerplate coding!
pyglons takes the ideas from Pylons
( a lightweight web framework emphasizing
flexibility and rapid development )
and uses them to create a framework for Pyglet
( a cross-platform windowing and
multimedia library for Python) .... )
pyglons, the module:
"( a module containing an application base class,
a state class and some predefined states
that you may or may not require depending on your needs.)
pyglons, the templates:
"( templates for the paster command
that creates your application directory and initial layout.
The default templates create a small working application
with splash screen, menu, help and
very basic application state
ready for you to add your code.
The templates also create all the required files
to use your application with distutils/setuptools.
The default pyglons app depends on pyglet and pyglons.)
"( Layer is a set of somewhat disjoint modules
on top of pyglet, YAML, and other Python libraries
designed to smooth over strangeness
and allow for rapid iteration in game design and development.)
pgedraw -- Simple library that
make[s] it easy to draw in 2d with pyglet
"( the goal of this very simple library
is to cover up the lack of a decent
drawing system in pyglet.
. pgedraw helps to draw 2d
geometrical shapes with pyglet.
A simple way to clear the screen
and to enable alpha channel is provided, too.
Drawing are made using pyglet's OpenGl api,
but knowledge of OpenGl is not required to use pgedraw.
Pgedraw offers also a collision detection system
that can be used to check if the user is
clicking inside a drawn shape.)
python-pyknic -- A boilerplate library for
the rapid creation of 2D games in Python.
-- Feed GLSL shaders into OpenGL from Python
(uses pyglet bindings)
los-cocos -- cocos2d: A framework for building 2D games
"( cocos2d is a framework for building 2D games, demos,
and other graphical/interactive applications.
It is built over pyglet.
. helps you structure a "scene based application".
Cocos simplifies the game development in these areas:
Flow control: Manage the flow control
between different scenes in an easy way .
Sprites: Fast and easy sprites .
Actions: Just tell sprites what you want them to do.
Composable actions like move, rotate, scale, etc .
Effects: Effects like waves, twirl, lens and much more .
Tiled Maps:
Support for rectangular and hexagonal tiled maps .
Collision: Basic pure python support for collisions .
Transitions: Move from scene to scene with style .
Menus: Built in classes to create menus .
Text Rendering:
Label and HTMLLabel with action support .
Built-in Python Interpreter: For debugging purposes .
Access to OpenGL functionality .)
== libraries that use Pyglet ==
bruce-tpt -- Bruce, the Presentation Tool
"( It uses pyglet to display via OpenGL
and handle multi-head
(the most common presentation setup)
so you can have the presentation displayed on a projector
while your laptop displays the original presentation source .)
pyglet-twisted -- Twisted reactor for Pyglet
"( . develops a Twisted reactor for Pyglet.
The aim is to enable Twisted's networking capabilities
to be fully integrated within the Pyglet event loop,
introduced in version 1.1.)
skyseam -- Utilities for 2.5D graphics in python
"( . a utility to orient a spherical projection
to suit a list of camera views.
pyglet based ui for visualization and testing.)
pyevocomm -- a simple open Framework for Accesibility
"( Designed with the MVC pattern,
adds to the view beyond,
the voice properties suitable for
people with low vision .)
py-lepton -- High-performance, pluggable particle engine
and API for Python
"( make complex and beautiful particle effects;
Two pluggable OpenGL renderers,
and two pygame renderers
Modular architecture:
easily configure and customize the engine .)
roller-ball -- A Python/OpenGL Game
"( PyODE engine with OpenGL calls
using Pyglet framework .)
"( Flashes / strobes your screen with random solid colors.
Intended to try and fix stuck pixels on LCD TVs and monitors.
All you need to run this is python and pyglet ).
pynewt -- Pure python rigid body dynamics library
"( Uses  pyglet for rendering,
needs pyeuclid for all vector/quaternion maths.)
news.cyb/dev.py/ui frameworks:
PyGame  -- graphics and sound by SDL
pyglet -- minimalistic;
tends to be basis of game engines .

Panda3D -- game engine
PyOpenGL -- graphics library
OGRE -- scene-oriented, flexible 3D
   rendering engine (as opposed to a game engine)
TurboGears, Django -- web apps
urwid -- console user interface library for Python.
PyQT -- cross-platform GUI toolkit
wxPython -- a widget toolkit and tools library for gui's;
. for more see list of game engines (python):
blender -- listed under ray tracers too .
Ignifuga Game Engine
-- for lesser game engines and media kits
see wikibooks .

wikipedia`game engine:
. a system designed for the creation and
development of video games.
The leading game engines provide a software framework
that developers use to create games for
video game consoles and personal computers.
The core functionality typically provided by a game engine
includes a rendering engine (“renderer”) for 2D or 3D graphics,
a physics engine or collision detection (and collision response),
sound, scripting, animation, artificial intelligence,
networking, streaming, memory management, threading,
localization support, and a scene graph.
The process of game development is often economized,
in large part, by reusing/adapting the same game engine
to create different games,
or to make it easier to "port" games to multiple platforms.
Recent Trends
. As game engine technology matures and becomes more user-friendly,
the application of game engines has broadened in scope.
They are now being used for serious games:
visualization, training, medical, and military simulation applications.
To facilitate this accessibility,
new hardware platforms are now being targeted,
including mobile phones (e.g. Android phones, iPhone)
and web browsers (e.g. WebGL, Shockwave, Flash, Trinigy's WebVision,
Silverlight, Unity Web Player, O3D and pure dhtml).
Additionally, more game engines are being built upon
higher level languages such as Python (Panda3D).
As most 3D rich games are now mostly GPU-limited
(i.e. limited by the power of the graphics card),
the language's impact on speed becomes negligible,
while the productivity gains offered by these languages
work to the game engine developers' benefit .
Game Middleware
. In the broader sense of the term,
game engines themselves can be described as middleware.
In the context of video games, however,
the term "middleware" is often used to refer to
subsystems of functionality within a game engine.
Some game middleware does only one thing
but does it more convincingly or more efficiently
than general purpose middleware.
For example, SpeedTree renders the realistic vegetation
and, Fork Particle simulate real time Particle Systems .