FAQ Database Discussion Community


Drawing a circle with a triangle fan

python,opengl,geometry,trigonometry,pyglet
I've tried to draw a circle with Pyglet and I have failed. With beautiful and unexpected results, though. I have worked out the math: I have implemented the method: """ Pyglet utilities. Designed to ease drawing of primitives with Pyglet. """ # Dependencies import pyglet from math import sin, cos...

Python Game Libraries

python,pygame,pyglet,cocos2d-python
First off please do not mark this topic as a duplicate. All the relevant threads are years old. I would like updated information. What are the pros and cons of the following libraries? I am aware of: PyGame, seems to be the most popular but the website is full of...

AVBin in cxfreeze

python,executable,cx-freeze,pyglet
I'm having a bit of trouble in Python 3 lately. i have a program that uses Pyglet and AVBin to play sound into my game. It's one of my socket tests, so I want to test the game with someone that doesn't even own python. I used to use cx_Freeze...

Pyglet: 'str' object has no attribute 'audio_format' (python)

python,multithreading,audio,pyglet
Im attempting to play an Mp3 file in pyglet from a file chosen through open file dialogue, but even though the file ends with a .mp3 extension, i still receive the error: Exception in thread Thread-1: Traceback (most recent call last): File "C:\Python34\lib\threading.py", line 921, in _bootstrap_inner self.run() File "C:\Python34\lib\threading.py",...

Key polling with cocos2d-python and pyglet

python,sprite,pyglet,cocos2d-python
I'm trying to move a sprite while a key is pressed. I can do it with on_key_press() and on_key_release(), but with these I run into problems with moving right while holding left and vice versa. I'd like to use key polling and found this from the pyglet documentation. from pyglet.window...

Add a python flag cx_freeze to executable

python,optimization,distribution,cx-freeze,pyglet
I'm making a game using pyglet, which runs like a tortoise (~30-35 FPS) unless I pass the -O flag to python when running it (which gives me a smooth 60FPS). I'm planning on using cx_freeze to distribute it, but I need the -O flag to be used every time the...

Pyglet running multiple windows

python,unit-testing,pyglet
I have problem when running some test code. There is a lot of code so I will paste only summary of a problem: import pyglet class Test(object): def setUp(self): self.window = pyglet.window.Window() def tearDown(self): del self.window def wtf(self): self.setUp() self.tearDown() self.setUp() pyglet.app.run() test = Test() test.wtf() I would expect upper...

Incorrectly drawn octagon (random) - NEW TEST ADDED

python,opengl,graphics,polygon,pyglet
I'm trying to draw an octagon with Python 3.4 and Pyglet 1.2, which uses OpenGL. My code seems to be correct but the drawing sometimes has additional triangle of random color (white or black most of the time) at random position (0, 0 (bottom left) corner most of the time)...

Need help Converting a pixel, into a OpenGL coordanite

python,opengl,3d,pyglet
My Pyglet application is loading this model properly except pyglet is using pixels instead of opengl coordanites how do I change this so that pyglet will now use opengl's coordanite system when rendering? If you need any code snippet's just ask and I will post it!...