This works as expected on my Linux machines. What system, and Python
distribution are you using?
Traceback (most recent call last):
File "lab3.py", line 11, in <module>
app.run()
File "/home/ben/Documents/PycharmProjects/pyglet/pyglet/app/__init__.py",
line 142, in run
event_loop.run()
File "/home/ben/Documents/PycharmProjects/pyglet/pyglet/app/base.py",
line 175, in run
self._run()
File "/home/ben/Documents/PycharmProjects/pyglet/pyglet/app/base.py",
line 188, in _run
platform_event_loop.step(timeout)
File "/home/ben/Documents/PycharmProjects/pyglet/pyglet/app/xlib.py",
line 125, in step
device.select()
File "/home/ben/Documents/PycharmProjects/pyglet/pyglet/canvas/xlib.py",
line 201, in select
dispatch(e)
File
"/home/ben/Documents/PycharmProjects/pyglet/pyglet/window/xlib/__init__.py",
line 898, in dispatch_platform_event_view
event_handler(e)
File
"/home/ben/Documents/PycharmProjects/pyglet/pyglet/window/xlib/__init__.py",
line 1062, in _event_key_view
self.dispatch_event('on_key_press', symbol, modifiers)
File
"/home/ben/Documents/PycharmProjects/pyglet/pyglet/window/__init__.py",
line 1229, in dispatch_event
if EventDispatcher.dispatch_event(self, *args) != False:
File "/home/ben/Documents/PycharmProjects/pyglet/pyglet/event.py", line
361, in dispatch_event
if handler(*args):
File "lab3.py", line 9, in on_key_press
raise RuntimeError("this is a test")
RuntimeError: this is a test
On Tuesday, July 17, 2018 at 6:00:48 PM UTC+9, Paul Iyobo wrote:
>
> when I press R the error isn't raised like it should.
>
> Il giorno lunedì 16 luglio 2018 17:25:20 UTC+2, Paul Iyobo ha scritto:
>
>> Hi there.
>> While I was using pyglet I faced this issue.
>> When I was running the program, and an error would occur, the eventloop
>> wouldn't raise the error.
>> For confirming my suspect I tried making a window screen which would
>> raise a runtimeerror as soon as the key R was pressed
>> The code looks like this
>> from pyglet import app
>> from pyglet.window import Window, key
>>
>> win = Window(caption='test')
>>
>> @win.event
>> def on_key_press(symbol, modifiers):
>> if symbol == key.R:
>> raise RuntimeError("this is a test")
>>
>> app.run()
>>
>> how can I fix it?
>> Is my pyglet set up in a wrong way?
>>
>
--
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.