pyglet

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. ...

How to stop audio with pyglet when file is played?

I'm using this program to play na audio file: music = pyglet.resource.media('file.wav') music.play() pyglet.app.run() I have a problem: I can't do anything after this program. How to stop the audio file when is played? It's look like a loop. ...

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 symbol == pyglet.window.key.ESCAPE: pass but that does not seem to work. ...

Frame Buffers wont work with pyglet.

I have this code: def setup_framebuffer(surface): #Create texture if not done already if surface.texture is None: create_texture(surface) #Render child to parent if surface.frame_buffer is None: surface.frame_buffer = glGenFramebuffersEXT(1) glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, surface.frame_buffer) glFramebufferTexture2DEX...

Implementing pyglet breaks my once working framebuffer OpenGL code.

This question repeats my earlier one but my earlier one was a failure because I didn't copy some vital information correctly, so I have to redo it. I'm getting an error with a call to an OpenGL function. Maybe pyglet isn't initialising OpenGL correctly? The error happens with a simple function that worked before: def setup_framebuffer...

How do I render text with pixel heights rather than points in pyglet?

Pyglet only seems to use points. Is there a way to convert easily? Surely there must be a simple way because it's something obviously important, to be able to use pixels for text height. class Font(): def __init__(self,font,size): self.size = size self.font = font def return_surface(self,label): surface =...

motion computation from video using pyglet in python

Hi, I am writing a simple motion detection program but i want it to be cross platform so im using python and the pyglet library since it provides a simple way to load videos in different formats (specially wmv and mpeg). So far i have the code given below which loads the movie and plays it in a window. Now i need to: 1) grab frame at tim...

Pyglet isn't displaying fonts to the correct size.

I took advice from an answer to another question I asked which led to me using a DPI of 72 to match points to pixels for the text in my game. The problem is that pyglet is rendering text far too big or far too small. Perhaps it depends on the framebuffer size? I haven't got a clue. Here's my code for rendering fonts: class Font(): ...

pyglet and animated gif

Hello, I have a message box pop up when a certain operation is being executed sort of "wait..." window and I want to have a "loading" *.gif animation there to lighten up the mood :) Anyways I can't seem to figure out how to make this work. What i have now is a code where img_wait is a gif but it wont animate. It only shows first frame....

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 * window = pyglet.window.Window(resizable=True...

Python "draw() must be called with Label instance as first argument (got _WindowMetaclass instance instead)"

This is a class I made using Python with pyglet to display a window. class Window(pyglet.window.Window): def __init__(self): super(Window, self).__init__() pyglet.text.Label("Prototype") windowText = text.Label.draw(Window, "Hello World", font_name = "Times New Roman", ...

"TypeError: draw() takes exactly 1 non-keyword argument (3 given)"

I wrote this code to open a window with Pyglet in Python... import pyglet from pyglet import window class Window(pyglet.window.Window): def __init__(self): super(Window, self).__init__() myLabel = pyglet.text.Label("Prototype") windowText = myLabel.draw(Window, "Hello World", font_n...

TypeError: unsupported operand type(s)

This is a program I'm writing that's supposed to display some text in a window... import pyglet from pyglet import window from pyglet.text.layout import TextLayout class Window(pyglet.window.Window): def __init__(self): super(Window, self).__init__(width = 800, height = 600, caption = "Proto...

how to display a numpy array with pyglet?

I have a label matrix with dimension (100*100), stored as a numpy array, and I would like to display the matrix with pyglet. My original idea is to use this matrix to form a new pyglet image using function pyglet.image.ImageData(). It requres a buffer of the imagedata as an input, however I have no idea how to get a right formated buffe...

pixelwise drawing in pyglet (python)

OK. I'm tired of googling and reading throught lots of documentation with no results. My aim is simple: get pyglet to draw an image pixel by pixel. I've been searching for hours with no results. Can anyone give an example of a short program that draws in a display specifying the color pixel by pixel? (for example, drawing a gradient fro...

pyglet silent exit with multiprocessing?

Pyglet exits unexpectedly and silently if I do this: from multiprocessing import Process import pyglet from pyglet.gl import * def myProcess(): w = pyglet.window.Window() pyglet.app.run() p = Process(target = myProcess) p.start() while p.is_alive(): pass It works as expected (opens an empty window and sits there) if I ch...

How to load an animation from a tiled spritesheet in cocos2d/pyglet

I have a tiled spritesheet saved as a png image that I want to load as a pyglet.image.Animation. I can see how to load an animation from a gif or a series of images, but I can't even figure out how to preform image slicing on images. ...

Unable to import pyglet.media.avbin

My traceback is as follows: C:\Romeo\Scripts>python Python 2.7 (r27:82525, Jul 4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)] on win 32 Type "help", "copyright", "credits" or "license" for more information. >>> import pyglet.media.avbin Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Romeo\lib\site-pa...

Setting individual pixels in Pyglet

Is there a way to set individual pixel values for image data in Pyglet? I guess it can also be done by setting the OpenGL rendering mode to points, so if someone has insight on this, please share it as well. ...