## 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 downRuntimeError: EventLoop.run() must be called from the same thread that imports pyglet.app
--
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 pyglet-users+unsubscribe@googlegroups.com.
To post to this group, send email to pyglet...@googlegroups.com.
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and all its topics, send an email to pyglet-users...@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to pyglet-users+unsubscribe@googlegroups.com.
from pyglet.window import key
window = pyglet.window.Window()
keys = key.KeyStateHandler()
window.push_handlers(keys)
def check_key_status(dt):
global keys
if keys[key.J]:
do_something()
pyglet.clock.schedule_interval(check_key_status, 1/60.0)
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 pyglet-users+unsubscribe@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to pyglet-users+unsubscribe@googlegroups.com.
--
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 pyglet-users+unsubscribe@googlegroups.com.