Fandom

Python Wiki

Modules/Pyglet

Redirected from Pyglet

43pages on
this wiki
Add New Page
Talk0 Share

Pyglet is a module for Python allowing OpenGL support for Python through a simple API.

Examples Edit

Hello World Edit

import pyglet
 
ourwnd = pyglet.window.Window() # create a Window object
 
# create a Label
label = pyglet.text.Label('Hello, Python Wiki!',
                          font_name='Times New Roman',
                          font_size=36,
                          x=ourwnd.width//2, y=ourwnd.height//2,
                          anchor_x='center', anchor_y='center')
 
# decorator meaning window event triggers follow
@ourwnd.event
def on_draw():
    ourwnd.clear()
    label.draw()
 
# Run
pyglet.app.run()

Links Edit

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.