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
5
votes
3 answers

How to use pyglet within a class

In all the tutorials on the web I've seen with Pyglet, it doesnt seems that any of them have used classes to contain the pyglet.window.Window instance. For example, most tutorials seem to go something like import pyglet game_window =…
pipsqueaker117
  • 2,280
  • 9
  • 35
  • 47
5
votes
2 answers

Error installing PyObjc: command '/usr/bin/clang' failed

I've been working on a python script, first using the Psychopy compiler, which already included all I needed, but now I need to make it the more independent as possible. I have the script working on a Windows computer, but I also want it to work in…
jl.da
  • 627
  • 1
  • 11
  • 30
5
votes
3 answers

Rendering mathematical notation in Python / OpenGL?

How can I render mathematical notations / expressions in Python with OpenGL? I'm actually using pyglet however it uses OpenGL. Such things as this: I can't store static images as I am generating the expressions as well.
AnnanFay
  • 9,573
  • 15
  • 63
  • 86
5
votes
2 answers

Explain to me like I am 5: OpenGL 4.x Rendering Pipeline

I have spent the last couple of weeks in my off-time looking at openGL. And while I do not have a problem following some of the older NeHe examples, from everything I have read, OpenGL4 is a totally different process. And I have access to the red…
Brian Bruggeman
  • 5,008
  • 2
  • 36
  • 55
5
votes
3 answers

Workaround for equality of nested functions

I have a nested function that I'm using as a callback in pyglet: def get_stop_function(stop_key): def stop_on_key(symbol, _): if symbol == getattr(pyglet.window.key, stop_key): pyglet.app.exit() return…
ontologist
  • 595
  • 4
  • 20
5
votes
2 answers

How to pan and zoom properly in 2D?

All I want to do is create a really simple pan and zoom feature in 2D with OpenGL through pyglet. As you can see, the zooming is working perfectly after the first jump:( Then again, the dragging (panning) is also working, but it also jumps (and it…
Peter Varo
  • 11,726
  • 7
  • 55
  • 77
5
votes
2 answers

Loading an image using Pyglet

I am playing around with pyglet 1.2alpha-1 and Python 3.3. I have the following (extremely simple) application and cannot figure out what my issue is: import pyglet window = pyglet.window.Window() #image = pyglet.resource.image('img1.jpg') image =…
Mike Caputo
  • 1,156
  • 17
  • 33
5
votes
2 answers

Open a pyglet window without taking focus

My python application launches a subprocess that creates a pyglet window. When the pyglet window opens, it is in front of all other windows, and takes keyboard focus. I'd like my pyglet window to open in the background, and not take focus. Is this…
Andrew
  • 2,842
  • 5
  • 31
  • 49
5
votes
1 answer

Pyglet drawing a set of images to a larger one

Is there any way to draw a whole lot of small images to a larger one so only the large image need be moved? Specifically I am making a top down tile based rpg and I was experimenting with map scrolling. Moving each tile was far slower than moving…
user1237200
  • 149
  • 4
  • 13
5
votes
2 answers

Programmatic control of python optimization?

I've been playing with pyglet. It's very nice. However, if I run my code, which is in an executable file (call it game.py) prefixed with the usual #!/usr/bin/env python by doing ./game.py then it's a bit clunky. But if I run it with python -O…
timday
  • 24,582
  • 12
  • 83
  • 135
5
votes
4 answers

Playing music with Pyglet and Tkinter in Python

I wanted to create a simple gui with a play and stop button to play an mp3 file in python. I created a very simple gui using Tkinter that consists of 2 buttons (stop and play). I created a function that does the following: def playsound () : …
Paul
  • 1,059
  • 4
  • 17
  • 23
4
votes
1 answer

Using glGetFloatv to retrieve the modelview matrix in pyglet

I'm doing 3d visualization in python using pyglet, and need to retrieve the modelview and projection matrices to do some picking. I define my window using: from pyglet.gl import * from pyglet.window import * win = Window(fullscreen=True,…
user1223904
  • 43
  • 1
  • 3
4
votes
2 answers

Can't draw() sprites in pyglet

For some reason, I can't get pyglet to draw sprites. Here's my code: import pyglet game = pyglet.window.Window(640, 480, "I'm a window") batch = pyglet.graphics.Batch() pyglet.resource.path = ["."] pyglet.resource.reindex() image =…
SnowFatal
  • 2,431
  • 1
  • 15
  • 12
4
votes
3 answers

pyglet: blit a texture with specified alpha mask

How to blit a texture with additional alpha mask specified? Simply speaking, I want to make something like this:
4
votes
3 answers

Pyglet shaders not working, keep erroring

so i am following a tutorial series on pyglet but i cant make shaders because it causes errors v Traceback (most recent call last): File "/home/awesomenoob/Coding/Python/window_with_shade.py", line 20, in window=window1(1280,…