Re: a simple python error. How can I solve this?
Proper indentation is equally important for functions, loops, and if statements. Inconsistent indentation likely means that some lines are unevenly or improperly indented in a given code block, as Python uses indentation to determine what code runs where. Pyglet also comes with its own event loop which is started with the pyglet.app.run() line, and the window class comes with various functions for handling key and mouse input. I have a number of examples I could provide if you like. As for your current code you could try this:
import pyglet
from pyglet.window import key
import accessible_output2.outputs.auto
import time
window = pyglet.window.Window() speaker = accessible_output2.outputs.auto.Auto() speaker.speak("test program started") @window.event def on_key_press(symbol, modifiers): speaker.speak("please press space") if symbol == key.SPACE: print('press') speaker.speak("space was pressed") else: speaker.speak("unknown key") print("now sleeping") time.sleep(10) pyglet.app.run()
_______________________________________________ Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector