cons/pros of pygame and pyglet [closed]

pygame is richly active, witness the Aug release of 1.9 with nokia s60 support, enhanced py2app/py2exe support, and a bevvy of experimental features (support for Python 3.1, webcams, gfx, …). Books like Hello World and periodic, fun competitions like ludumdare and pyweek bear witness to the vitality of its community and ecosystem. pyglet has a … Read more

Play WAV file in Python

You can use PyAudio. An example here on my Linux it works: #!usr/bin/env python #coding=utf-8 import pyaudio import wave #define stream chunk chunk = 1024 #open a wav format music f = wave.open(r”/usr/share/sounds/alsa/Rear_Center.wav”,”rb”) #instantiate PyAudio p = pyaudio.PyAudio() #open stream stream = p.open(format = p.get_format_from_width(f.getsampwidth()), channels = f.getnchannels(), rate = f.getframerate(), output = True) #read … Read more

Start with pyglet or pygame? [closed]

pygame is richly active, witness the Aug release of 1.9 with nokia s60 support, enhanced py2app/py2exe support, and a bevvy of experimental features (support for Python 3.1, webcams, gfx, …). Books like Hello World and periodic, fun competitions like ludumdare and pyweek bear witness to the vitality of its community and ecosystem. pyglet has a … Read more

How to run OpenAI Gym .render() over a server

Got a simple solution working: If on a linux server, open jupyter with $ xvfb-run -s “-screen 0 1400x900x24″ jupyter notebook In Jupyter import matplotlib.pyplot as plt %matplotlib inline from IPython import display After each step def show_state(env, step=0, info=””): plt.figure(3) plt.clf() plt.imshow(env.render(mode=”rgb_array”)) plt.title(“%s | Step: %d %s” % (env._spec.id,step, info)) plt.axis(‘off’) display.clear_output(wait=True) display.display(plt.gcf()) Note: … Read more