Python Forum
problems with pyglet error catching
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problems with pyglet error catching
#1
Hi there. While I was trying to use pyglet on windows, I tried making a test screen that would raise a runtime error as soon as I was going to press the key R. Code looks like this
from pyglet import app
from pyglet.window import Window, key

win = Window(caption='test application')
@win.event
def on_key_press(symbol, modifiers):
    if symbol == key.R:
        raise RuntimeError("this is a test")
app.run()
though, when I execute it, the window pops up, but if I press r, nothing happens.
I had issues like this with other projects, where if I had an error at runtime for example from an imported file, nothing would happen and the eventloop would run nomatter what.
Is this me being wrong, or is this an issue?
Thanks in advance.
Reply
#2
Your could works fine for me.
Maybe instead of raise RuntimeError.
print("print this is a test")
or do both.
99 percent of computer problems exists between chair and keyboard.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Pygame or Pyglet luke83 4 4,096 Nov-20-2020, 09:15 PM
Last Post: luke83
  [Pyglet] pyglet freezing pfaber11 1 2,865 Jun-06-2019, 04:31 PM
Last Post: Windspar
  PyGlet Trouble Drawing Cube. Windspar 3 5,699 Jan-02-2018, 06:37 PM
Last Post: Windspar

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020