Questions tagged [pyglet]

Pyglet is a cross-platform windowing and multimedia library for Python which provides interface to the platform's OpenGL library.

Pyglet is a cross-platform windowing and multimedia library for Python which provides interface to the platform's OpenGL library.

Pyglet has built-in support for mouse and keyboard events, and can load several multimedia file formats (optionally via AVbin). OpenAL, DirectSound or ALSA can be used for audio playback, with 3D positional audio support.

Pyglet is divided into several interdependent modules such as pyglet.gl, pyglet.graphics, pyglet.image, pyglet.media, pyglet.text, and pyglet.window.

919 questions
98
votes
14 answers

How to run OpenAI Gym .render() over a server

I am running a python 2.7 script on a p2.xlarge AWS server through Jupyter (Ubuntu 14.04). I would like to be able to render my simulations. Minimal working example import gym env = gym.make('CartPole-v0') env.reset() env.render() env.render()…
Toke Faurby
  • 5,788
  • 9
  • 41
  • 62
47
votes
5 answers

Differences between Python game libraries Pygame and Pyglet?

I've had some experience with Pygame, but there seems to be a lot of buzz around Pyglet these days. How do these two libraries compare? What would be the advantage of using one over the other, both in features and ease of use? Finally, would you say…
nakedfanatic
  • 3,108
  • 2
  • 28
  • 33
44
votes
3 answers

Start with pyglet or pygame?

I would like to know what is the best to start with, pyglet or pygame? Which one is faster and which one is more active? I would also like to know if pyglet will get python 3 support, because I have read here that it might not be possible or it…
Reshure
  • 3,295
  • 5
  • 28
  • 26
39
votes
5 answers

Play WAV file in Python

I tried PyGame for playing a WAV file like this: import pygame pygame.init() pygame.mixer.music.load("mysound.wav") pygame.mixer.music.play() pygame.event.wait() but It change the voice and I don't know why! I read this link solutions and can't…
nim4n
  • 1,813
  • 3
  • 21
  • 36
27
votes
5 answers

is it possible to run pygame or pyglet in a browser?

I have 3 game libraries installed on my PC: pyglet, pygame and Panda3D. I would like to create a 2D game and make it a web browser game so i can put it on facebook. I know that Panda3D has a web-browser-plugin. Panda3D is for 3D games…
Lynob
  • 5,059
  • 15
  • 64
  • 114
26
votes
9 answers

PyOpenGl or pyglet?

I am looking to do some tinkering with openGL and Python and haven't been able to find good reasons for using PyOpenGl versus pyglet Which would you recommend and why?
Hortitude
  • 13,638
  • 16
  • 58
  • 72
22
votes
8 answers

Python pyglet AVBin - How to install AVBin

AVBin is used by Pyglet to decode MP3s. Link: http://avbin.github.com/AVbin/Download.html Installed using install.sh provided, when utilised leads to error: 'AVbin is required to decode compressed media') pyglet.media.riff.WAVEFormatException: AVbin…
xxjjnn
  • 14,591
  • 19
  • 61
  • 94
16
votes
1 answer

How to play streaming audio using pyglet?

The goal of this question is trying to figure out how to play streaming audio using pyglet. The first is just making sure you're able to play mp3 files using pyglet, that's the purpose of this first snippet: import sys import inspect import…
BPL
  • 9,632
  • 9
  • 59
  • 117
16
votes
5 answers

Abort trap: 6 when running a python script

I am working on a python program that displays an animation, thus I am using pyglet. Until now I've been working with the python compiler that comes with Psychopy, but now I need to make this program as most independent as possible. I have achieved…
jl.da
  • 627
  • 1
  • 11
  • 30
13
votes
2 answers

ImportError: Can't find framework /System/Library/Frameworks/OpenGL.framework

I am trying to run this simple gym example on the new macOs Big Sur. import gym env = gym.make('CartPole-v0') env.reset() for _ in range(1000): env.render() env.step(env.action_space.sample()) # take a random action env.close() However, I…
PeeteKeesel
  • 634
  • 1
  • 7
  • 18
13
votes
1 answer

Temporary images with Pyglet

Is there a way to make a temporary "image" with Pyglet? (Something akin to LÖVE's Canvas). Basically, I want to have an object that I could blit stuff like sprites and text to, and then blit this temporary image to the window. I tried creating an…
art-solopov
  • 4,289
  • 3
  • 25
  • 44
13
votes
6 answers

Pythonic and efficient way of finding adjacent cells in grid

I am building a tile based app in Python using pyglet/openGL wherein I'll need to find the all of the adjacent cells for a given cell. I am working in one quadrant of a Cartesian grid. Each cell has an x and y value indicating it's position in the…
JeremyFromEarth
  • 14,344
  • 4
  • 33
  • 47
12
votes
5 answers

How do you separate each channel of a two channel wav file into two different files using wavio? or another library?

The following script plays the original file ok. I try to separate each channel in the obvious way, but it does not work. import os import wavio import numpy import pyglet file_name = "guitarup_full.wav" # I get the file ! File =…
mm_
  • 1,566
  • 2
  • 18
  • 37
11
votes
2 answers

Pyglet OpenGL drawing anti-aliasing

I've been looking around for a way to anti-alias lines in OpenGL, but none of them seem to work... here's some example code: import pyglet from pyglet.gl import * …
Jared Forsyth
  • 12,808
  • 7
  • 45
  • 54
10
votes
4 answers

Pyglet, how to make the ESCAPE key not close the window?

I am writing a small sample program and I would like to override the default pyglet's behavioyr of ESC closing the app. I have something to the extent of: window = pyglet.window.Window() @window.event def on_key_press(symbol, modifiers): if…
Bartosz Radaczyński
  • 18,396
  • 14
  • 54
  • 61
1
2 3
61 62