No. I just used loop + dispatch_events() manually.

On Jul 3, 2017 1:00 PM, "Benjamin Moran" <[email protected]> wrote:

> Are you using pyglet.app.run() in your code?
>
>
> On Sunday, July 2, 2017 at 11:29:12 PM UTC+9, 杨金骉 wrote:
>>
>> I'm building a real-time sound controller.
>> I tried to put the sound player and detector of keypress in different
>> threads, and used a variable as the messenger. Below is the demo code:
>>
>> ## detector
>> def wait():
>>     while True:
>>         win.dispatch_events()
>>
>>                      shared.pressing = e['key'] # the got key
>>
>>         if shared.figure_released:
>>             shared.pressing = None
>>
>>         time.sleep(0.01)
>>
>>
>> td = threading.Thread(target=wait)
>> td.start()
>>
>> ## player
>> while 1:
>>    if shared.pressing=='k':
>>        # pitch up
>>    elif shared.pressing=='j':
>>        # pitch down
>>
>> And then I got the error:
>>
>>> *RuntimeError: EventLoop.run() must be called from the same thread that
>>> imports pyglet.app*
>>
>>
>>
>> Why can't pyglet get the events from another thread?
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "pyglet-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/pyglet-users/PrD2Z8O1qnI/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/pyglet-users.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to