HOME

TheInfoList



OR:

Pyglet is a
library A library is a collection of Book, books, and possibly other Document, materials and Media (communication), media, that is accessible for use by its members and members of allied institutions. Libraries provide physical (hard copies) or electron ...
for the Python
programming language A programming language is a system of notation for writing computer programs. Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
that provides an
object-oriented Object-oriented programming (OOP) is a programming paradigm based on the concept of '' objects''. Objects can contain data (called fields, attributes or properties) and have actions they can perform (called procedures or methods and impleme ...
application programming interface An application programming interface (API) is a connection between computers or between computer programs. It is a type of software Interface (computing), interface, offering a service to other pieces of software. A document or standard that des ...
for the creation of games and other multimedia
applications Application may refer to: Mathematics and computing * Application software, computer software designed to help the user to perform specific tasks ** Application layer, an abstraction layer that specifies protocols and interface methods used in a ...
. pyglet runs on
Microsoft Windows Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
,
macOS macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
, and
Linux Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
; it is released under the BSD Licence. pyglet was first created by Alex Holkner.


Features

Pyglet is written entirely in Python. Images, video, and sound files in a range of formats can be done natively but can also be expanded with the libav and
ffmpeg FFmpeg is a free and open-source software project consisting of a suite of libraries and programs for handling video, audio, and other multimedia files and streams. At its core is the command-line ffmpeg tool itself, designed for processing vide ...
libraries. It requires no external dependencies. Text display and formatting * Rich text formatting (bold, ''italic'', underline, color change, background color, indent, lists) (pyglet.text.formats) * Built-in layouts to support editable text * Carets (pyglet.text.caret.Caret) * HTML support (pyglet.text.layout.IncrementalTextLayout) Image and sprite work * Fast image processing and rendering * Built-in sprites (pyglet.sprite) * Animated images (*.gif) Graphics * OpenGL shaders supported * Simple built-in shapes (rectangles, circles, triangles) (pyglet.shapes) * Batched rendering (pyglet.graphics.Batch) * 3D model rendering Events and file system * Resource management (pyglet.resource) * Clock for processing events and time (pyglet.clock.Clock) * Window events (pyglet.window.Window) * Event dispatching (pyglet.event.EventDispatcher) * Context management Sprites, text layouts, and text functions are implemented. Multi-level lists are supported and can be created using HTML. Different sections of the displayed document can have distinct styles. A built-in caret provides support for text editing, resembling many features of a UI text input caret.


Example

from pyglet.window import Window from pyglet.app import run window = Window(caption="Hello world!", width=640, height=480) run() In this example, lines 1-2 import the pyglet module's necessary components. Line 4 creates a window, and line 6 calls pyglet to run its event loop. Optionally an update rate (in frames per second) can be specified in a rate parameter.


See also

*
Pygame Pygame is a cross-platform set of Python modules designed for writing video games. It includes computer graphics and sound libraries designed to be used with the Python programming language. History Pygame was originally written by Pete Shinne ...
, another Python game API, a layer over Simple DirectMedia Layer * Kivy (framework), a Python OpenGL-based UI for multitouch interactions * Cocos2d * Panda3D


References


External links

* {{Official website, http://www.pyglet.org/
Official documentation


the wrapper for libav Articles with example Python (programming language) code Python (programming language) libraries Software using the BSD license