I'm trying to program something using vPython. It's kind of a game, but controls won't work properly.
while True:
"verarbeitet Maus/Tastatureingaben"
if scene.kb: # wenn Aktion auf der Tastatur...
druck=scene.kb.getkey() # ...Tastendruck speichern!
# ----Aktionen bei bestimmten Tasten---- #
if druck == "w": # vor
self.bewegen(self.axis)
elif druck == "s": # zurück
self.bewegen(-self.axis)
So there are two main problems:
Two keys can't be pressed at the same time. Only the one pressed latest is working.
If holding a key for about 5 seconds the action will take much longer (I think that's because MS Windows
takes a small break after each 'hit').
I hope you can help me!
did you try running your script with -u option:
python -u myscript.py
You can find documentation on this option here
As per document:
Force stdin, stdout and stderr to be totally unbuffered. On systems where it matters,
also put stdin, stdout and stderr in binary mode.