4 ms·
Pyglet looks great, but drawing is done in OpenGL way. Is there a libraray that uses pyglet giving it the drawing interface more limilar to what other 2d APIs
by scotty79 5y ago
Pyglet looks great, but drawing is done in OpenGL way.
Is there a libraray that uses pyglet giving it the drawing interface more limilar to what other 2d APIs offer? Like the one suppoted by HTML Canvas tag?
EDIT:
Never mind. I just noticed pyglet.shapes offers something more palatable than OpenGL. :-)
and doing stuff is pretty clean:
import pyglet
from pyglet import shapes
batch = pyglet.graphics.Batch()
circle = shapes.Circle(700, 150, 100, color=(50, 225, 30), batch=batch)
square = shapes.Rectangle(200, 200, 200, 200, color=(55, 55, 255), batch=batch)
window = pyglet.window.Window(960, 540)
@window.event
def on_draw():
window.clear()
batch.draw()
@window.event
def on_key_press(symbol, modifiers):
if symbol == pyglet.window.key.ESCAPE:
window.close()
pyglet.app.run()