views:

30

answers:

0

Pyglet exits unexpectedly and silently if I do this:

from multiprocessing import Process
import pyglet
from pyglet.gl import *

def myProcess():
    w = pyglet.window.Window()
    pyglet.app.run()

p = Process(target = myProcess)
p.start()
while p.is_alive():
    pass

It works as expected (opens an empty window and sits there) if I change it to (note the third import):

from multiprocessing import Process
import pyglet
from pyglet import gl

def myProcess():
    w = pyglet.window.Window()
    pyglet.app.run()

p = Process(target = myProcess)
p.start()
while p.is_alive():
    pass

But if I add a pyglet.window.Window subclass:

from multiprocessing import Process
import pyglet
from pyglet import gl

class foo(pyglet.window.Window):
    pass

def myProcess():
    w = pyglet.window.Window()
    pyglet.app.run()

p = Process(target = myProcess)
p.start()
while p.is_alive():
    pass

It fails as it does in the first case. Help?