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
-1
votes
1 answer

How does pyglet know how to run the on_draw() function?

Here's a quick python sample code using pyglet: import pyglet window = pyglet.window.Window() image = pyglet.resource.image('kitten.jpg') @window.event def on_draw(): window.clear() image.blit(0, 0) pyglet.app.run() I understand that…
-1
votes
1 answer

how to move sprites using Python,Pyglet?

No matter how hard I try, the sprite does not move, the code is correct, I would not ask, but I have a hopeless situation, help !! I have already used KeyStateHandler but it doesn't work either. import pyglet from pyglet.window import keys x =…
Adilet Usonov
  • 139
  • 1
  • 6
-1
votes
1 answer

why is pyglet failing to display my image?

I am using the latest pyglet and having extreme trouble displaying images. I have stripped my code down to the bare essentials and am baffled by the result: import pyglet pyglet.resource.path.append('Assets') pyglet.resource.reindex() look =…
Nick
  • 97
  • 10
-1
votes
1 answer

Why append() is called every loop?

I have got the tile class: class Tile: tile_pref = { "sprites": [] } pos = Vector2(vector_zero) def img(self, x, y, tilemap, t): return self.tile_pref["sprites"][0] def __init__(self, img, pos): …
ISD
  • 984
  • 1
  • 6
  • 21
-1
votes
1 answer

Want to play .wav audio file on Raspberrypi Python 3 Shell IDLE

I have installed many libraries and tried many different codes but I'm not able to play the audio file on Raspberry Pi 3B+. If you know any method or have any code. Must recommend me.
-1
votes
1 answer

How to improve this enemy AI?

This is my code so far: from JMSSGraphics import * import math import random class Zombie: # attributes: # x # y # infected # image # we need to define a special function # that lets us 'construct' an object from this…
-1
votes
2 answers

Haven't changed my code but it stopped working: `object has no attribute 'EOS_LOOP'`

Here is my full code: http://codr.io/tscumzc And the error occurs with a music player called player: Traceback (most recent call last): File "test.py", line 915, in player.eos_action = player.EOS_LOOP AttributeError: 'Player' object…
Jack Pan
  • 1,261
  • 3
  • 11
  • 12
-1
votes
2 answers

pyglet fullscreen window with size (640, 480)? (pyglet1.2.4)

I would like to benchmark pyglet against pygame (blit calls etc). In pygame, I tend to use a 640 x 480 fullscreen display. How can I create the same display (=window) in pyglet 1.2.4?
Don Polettone
  • 185
  • 1
  • 14
-1
votes
2 answers

Rotating sprite generate artifacts

I try to rotate a simple sprite with this code: test_img = pyglet.resource.image('img.png') self.test_sprite = pyglet.sprite.Sprite(img=test_img,x=300,y=400, batch=self.main_batch) def update(self, dt): self.test_sprite.rotation -= float(100 *…
NiBE
  • 857
  • 2
  • 16
  • 39
-1
votes
1 answer

AVBin in cxfreeze

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 for…
ErrorAtLine0
  • 179
  • 1
  • 8
-1
votes
1 answer

Python: cannot increase counter variable in function

I need to increase a counter variable, count, each time the mouse is pressed. I do not want to use global variables, and hence I get the following errors: I get global name 'count' is not defined, if I use the global count line in the on_mouse_press…
jl.da
  • 627
  • 1
  • 11
  • 30
-1
votes
1 answer

OpenGL Pyglet "Error: global name 'texture' not defined"

The error is on line 5: glBindTexture(texture.target, texture.id) 1. import pyglet 2. from pyglet.gl import * 3. class CustomGroup(pyglet.graphics.Group): 4. def set_state(self): 5. glEnable(texture.target) 6. …
itai12345
  • 25
  • 1
  • 4
-1
votes
1 answer

Game ai Line of Sight Python

How would I check to see whether the player is within range of a mob? (I am making a top down game in pyglet) I am making it so that the mobs follow and attack the player if he is within a certain distance of them but I am unsure how to efficiently…
user1237200
  • 149
  • 4
  • 13
-2
votes
1 answer

Pyglet displaying text over image

I am trying to display some text over an image using the pyglet library. However, I keep getting this "Texture Region" popping up instead of the actual text I included..Hoping someone can…
Wheatley
  • 35
  • 3
-2
votes
2 answers

How to quickly refresh images on screen with Python/OS-X and improve upon opencv's imshow()

I'm working on a Python (2.7.13) program that reads images from the webcam (refreshed on a separate thread), does a perspective transform, and puts the live video in a window on the screen, using opencv (3.2.0-dev). I get very low FPS (13) updating…
Jon R
  • 13
  • 5
1 2 3
61
62